|
| 1 | +# Python script to push and pull application config |
| 2 | + |
| 3 | +This script is used to push and pull secrets, s3 config and ssm values for use in applications. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +### Pushing Config |
| 8 | + |
| 9 | +``` |
| 10 | +Usage: croudtech-bootstrap put-config [OPTIONS] VALUES_PATH |
| 11 | +
|
| 12 | +Options: |
| 13 | + --prefix TEXT The path prefix (Name prefix used when storing secrets and SSM values) |
| 14 | + --region TEXT The AWS region (Defaults to the current region set using AWS_DEFAULT_REGION or AWS_REGION env vars) |
| 15 | + --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. |
| 16 | + --help Show this message and exit. |
| 17 | +``` |
| 18 | + |
| 19 | +The put-config command requires the following file structure: |
| 20 | + |
| 21 | +``` |
| 22 | +├── ENVIRONMENT_NAME_1 |
| 23 | +│ ├── common.yaml |
| 24 | +│ ├── common.secret.yaml |
| 25 | +│ ├── AppConfig1.yaml |
| 26 | +│ ├── AppConfig1.secret.yaml |
| 27 | +│ ├── AppConfig2.yaml |
| 28 | +│ └── AppConfig2.secret.yaml |
| 29 | +├── ENVIRONMENT_NAME_2 |
| 30 | +│ ├── common.yaml |
| 31 | +│ ├── common.secret.yaml |
| 32 | +│ ├── AppConfig1.yaml |
| 33 | +│ ├── AppConfig1.secret.yaml |
| 34 | +│ ├── AppConfig2.yaml |
| 35 | +│ └── AppConfig2.secret.yaml |
| 36 | +``` |
| 37 | + |
| 38 | +Running `python -m croudtech-bootstrap put-config CONFIG_FILES_PATH` will create config for AppConfig1 and AppConfig2 in both defined environments. |
| 39 | + |
| 40 | +common.yaml and common.secret.yaml files contain shared config that will be used for all applications. |
| 41 | + |
| 42 | +### Pulling config |
| 43 | + |
| 44 | +``` |
| 45 | +Usage: croudtech-bootstrap get-config [OPTIONS] |
| 46 | +
|
| 47 | +Options: |
| 48 | + --environment-name TEXT The environment name [required] |
| 49 | + --app-name TEXT The app name [required] |
| 50 | + --prefix TEXT The path prefix |
| 51 | + --region TEXT The AWS region |
| 52 | + --include-common / --ignore-common |
| 53 | + Include shared variables |
| 54 | + --output-format [json|yaml|environment|environment-export] |
| 55 | + --parse-redis-param / --ignore-redis-param |
| 56 | + Parse redis host and allocate a redis |
| 57 | + database number. Requires network access to the redis instance |
| 58 | + --help Show this message and exit. |
| 59 | +``` |
| 60 | + |
| 61 | +Using the put-config example above we can pull the config as follows |
| 62 | + |
| 63 | +``` |
| 64 | +croudtech-bootstrap get-config --environment-name ENVIRONMENT_NAME_1 --app-name AppConfig1 --output-format environment |
| 65 | +``` |
| 66 | + |
| 67 | +## Installation |
| 68 | + |
| 69 | +`pip install croudtech-bootstrap` |
| 70 | + |
0 commit comments