Skip to main content

# s3conf

[![Build Status](https://travis-ci.org/sbneto/s3conf.svg?branch=master)](https://travis-ci.org/sbneto/s3conf)

Utility package to help managing configuration files stored in S3-like services.

# Installation

There are binaries for Linux and Mac:

`bash sudo curl -L "https://github.com/sbneto/s3conf/releases/download/0.10.2/s3conf-$(uname -s)-$(uname -m)" -o /usr/local/bin/s3conf sudo chmod 755 /usr/local/bin/s3conf `

For Alpine linux, use

`bash sudo curl -L "https://github.com/sbneto/s3conf/releases/download/0.10.2/s3conf-$(uname -s)-$(uname -m)-alpine" -o /usr/local/bin/s3conf sudo chmod 755 /usr/local/bin/s3conf `

If it is not available for your platform, you can use pip to install with one or both extras (aws and gcp):

`python pip install s3conf[aws,gcp] `

# Usage

## Quick Start

### Create an Environment

Run this command in the project root:

`bash s3conf init dev s3://my-dev-bucket/dev-env/myfile.env `

This will create the file s3conf.ini if it does not exist and add the following lines to it:

`ini [dev] S3CONF = s3://my-dev-bucket/dev-env/myfile.env `

### S3 Credentials

If you have a aws-cli working, s3conf will user your default credentials. This can be done with:

`bash aws configure `

Similarly, s3conf looks for default gcp credentials.

`bash gcloud auth application-default login `

#### Manually setting the credentials

If you do not have a configured aws-cli, the client will search for these authentication variables in order to access the remote storage:

`bash S3CONF_ACCESS_KEY_ID=***access_key*** S3CONF_SECRET_ACCESS_KEY=***secret_access_key*** S3CONF_S3_ENDPOINT_URL=***endpoint_url*** `

These variables map to their AWS_ counterpart used for regular Boto3 configuration. The client also searchs for the regular AWS_ variables, but their S3CONF_* version take precedence. They are particularly useful when using non-aws blob storage services that are compatible with S3, such as DigitalOcean Spaces, without messing your AWS credentials.

### Edit your environment

Run this command in any folder of the project:

`bash s3conf env dev -e `

If it is a new bucket/file, use the -c flag to create it:

`bash s3conf env dev -ec `

This will download the environment file from the S3-like storage to a temporary file, open your default file editor for manual editing (much like as crontab -e works) and upload the file back to the remote storage service if any edits were made.

### Retrieve your environment

Running s3conf env dev in any folder of the project reads and output to stdout the contents of the environment file, while logs are sent to stderr:

`bash $ s3conf env dev info: Loading configs from s3://my-dev-bucket/dev-env/myfile.env ENV_VAR_1=some_data_1 ENV_VAR_2=some_data_2 ENV_VAR_3=some_data_3 `

To apply this environment to your current shell you can do the following:

`bash $ export $(s3conf env dev) info: Loading configs from s3://my-dev-bucket/dev-env/myfile.env `

### Adding a credential file to the environment

If you have some file or folder that you want to save in the environment, you can add a mapping:

`bash s3conf add dev ./some-credentials-file-or-folder `

### Pushing your credential files to the remote storage

`bash s3conf push dev `

### Retrieve your environment with file mappings

Use the -m flag to download the file mappings to your current project folder:

`bash export $(s3conf env dev -m) `

## Using With Docker

The most straight forward way to use this client with docker is to create an entrypoint.sh in your image that sets the environment variables and map all needed files:

`bash #!/usr/bin/env bash set -e export $(s3conf env dev -m) exec "$@" `

And use it when running your container (assuming your entrypoint is in /app/entrypoint.sh and *is executable*)

`bash docker run --entrypoint `/app/entrypoint.sh` my_image my_command `

Metadata

Release files for s3conf 0.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for s3conf 0.10.2
File Size Uploaded Provenance
s3conf-0.10.2.tar.gz 18.4 kB Without provenance Details

Release files / s3conf-0.10.2.tar.gz

Download URL s3conf-0.10.2.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
438c1947e64228bddd5a20af7225d82b654a68fcfed448256a53c52d96f4545f
BLAKE2b-256 checksum
How to use checksums
575978a1b9fe6d73c9637989e2aef75864c4d010227160ba5d28d5ece1e38d91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

Security for s3conf 0.10.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page