Package: s3conf
# 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.# InstallationThere 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 EnvironmentRun this command in the project root:`bash s3conf init devs3://my-dev-bucket/dev-env/myfile.env`This will create the files3conf.iniif it does not exist and add the following lines to it:`ini [dev] S3CONF =s3://my-dev-bucket/dev-env/myfile.env`### S3 CredentialsIf you have aaws-cliworking,s3confwill user your default credentials. This can be done with:`bash aws configure `Similarly,s3conflooks for default gcp credentials.`bash gcloud authapplication-defaultlogin `#### Manually setting the credentialsIf you do not have a configured aws-cli, the client will search for these authentication variables in
order to access the remote storage:`bashS3CONF_ACCESS_KEY_ID=***access_key***S3CONF_SECRET_ACCESS_KEY=***secret_access_key***S3CONF_S3_ENDPOINT_URL=***endpoint_url***`These variables map to theirAWS_counterpart used for regular Boto3 configuration.
The client also searchs for the regularAWS_variables, but theirS3CONF_*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 environmentRun this command in any folder of the project:`bash s3conf env dev-e`If it is a new bucket/file, use the-cflag 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 ascrontab -eworks) and upload the file back
to the remote storage service if any edits were made.### Retrieve your environmentRunnings3conf env devin 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 froms3://my-dev-bucket/dev-env/myfile.envENV_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 froms3://my-dev-bucket/dev-env/myfile.env`### Adding a credential file to the environmentIf 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 mappingsUse the-mflag to download the file mappings to your current project folder:`bash export $(s3conf env dev-m)`## Using With DockerThe most straight forward way to use this client with docker is to create anentrypoint.shin your image
that sets the environment variables and map all needed files:`bash#!/usr/bin/envbash set-eexport $(s3conf env dev-m)exec"$@"`And use it when running your container (assuming your entrypoint is in/app/entrypoint.shand*is executable*)`bash docker run--entrypoint`/app/entrypoint.sh` my_image my_command `