Metadata-Version: 2.1
Name: croudtech-bootstrap
Version: 0.1.35
Summary: Applicaton config via AWS S3 and AWS Secrets Manager
Home-page: http://github.com/CroudTech/croudtech-python-bootstrap-app
Author: Jim Robinson
Author-email: jscrobinson@gmail.com
License: mit
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: Intended Audience :: Developers
Description-Content-Type: text/markdown; charset=UTF-8
Requires-Dist: boto3==1.34.90; python_version >= "3.8"
Requires-Dist: botocore==1.34.90; python_version >= "3.8"
Requires-Dist: click==8.1.7; python_version >= "3.7"
Requires-Dist: jmespath==1.0.1; python_version >= "3.7"
Requires-Dist: python-dateutil==2.9.0.post0; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"
Requires-Dist: pyyaml==6.0.1; python_version >= "3.6"
Requires-Dist: redis==5.0.4; python_version >= "3.7"
Requires-Dist: s3transfer==0.10.1; python_version >= "3.8"
Requires-Dist: six==1.16.0; python_version >= "2.7" and python_version not in "3.0, 3.1, 3.2, 3.3"
Requires-Dist: table2ascii==1.1.3; python_version >= "3.7"
Requires-Dist: types-pyyaml==6.0.12.20240311; python_version >= "3.8"
Requires-Dist: urllib3==2.2.1; python_version >= "3.10"
Requires-Dist: wcwidth==0.2.13
Provides-Extra: testing
Requires-Dist: pytest; extra == "testing"

# Python script to push and pull application config

This script is used to push and pull secrets, s3 config and ssm values for use in applications.

## Usage

### Pushing Config

```
Usage: croudtech-bootstrap put-config [OPTIONS] VALUES_PATH

Options:
  --prefix TEXT   The path prefix (Name prefix used when storing secrets and SSM values)
  --region TEXT   The AWS region (Defaults to the current region set using AWS_DEFAULT_REGION or AWS_REGION env vars)
  --delete-first  Delete the values in this path before pushing (useful for cleanup) This will remove any values with the current path prefix that aren't included in the files we're pushing.
  --help          Show this message and exit.
```

The put-config command requires the following file structure:

```
├── ENVIRONMENT_NAME_1
│   ├── common.yaml
│   ├── common.secret.yaml
│   ├── AppConfig1.yaml
│   ├── AppConfig1.secret.yaml
│   ├── AppConfig2.yaml
│   └── AppConfig2.secret.yaml
├── ENVIRONMENT_NAME_2
│   ├── common.yaml
│   ├── common.secret.yaml
│   ├── AppConfig1.yaml
│   ├── AppConfig1.secret.yaml
│   ├── AppConfig2.yaml
│   └── AppConfig2.secret.yaml
```

Running `python -m croudtech-bootstrap put-config CONFIG_FILES_PATH` will create config for AppConfig1 and AppConfig2 in both defined environments.

common.yaml and common.secret.yaml files contain shared config that will be used for all applications.

### Pulling config

```
Usage: croudtech-bootstrap get-config [OPTIONS]

Options:
  --environment-name TEXT         The environment name  [required]
  --app-name TEXT                 The app name  [required]
  --prefix TEXT                   The path prefix
  --region TEXT                   The AWS region
  --include-common / --ignore-common
                                  Include shared variables
  --output-format [json|yaml|environment|environment-export]
  --parse-redis-param / --ignore-redis-param
                                  Parse redis host and allocate a redis
                                  database number. Requires network access to the redis instance
  --help                          Show this message and exit.
```

Using the put-config example above we can pull the config as follows

```
croudtech-bootstrap get-config --environment-name ENVIRONMENT_NAME_1 --app-name AppConfig1 --output-format environment
```

## Installation

`pip install croudtech-bootstrap`

