Easily build configuration files from templates.
Project description
Installation
pip install confspawn
Usage
Two CLI commands are available, confspawn
and confenv
.
usage: confenv [-h] -c CONFIG -v VARIABLE
Retrieve configuration value from TOML file.
examples:
confenv -c ./confs/sample_config.toml -v test.coolenv
export TEST_VAR=$(poetry run confenv -c ./confs/sample_config.toml -v test.coolenv)
optional arguments:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
File path for your TOML configuration file.
-v VARIABLE, --variable VARIABLE
Variable name to print. For nested keys, use e.g.
'toplevel.secondlevel.varname'.
-e ENV, --env ENV Useful to specify environment-related modes, i.e.
production or development. 'confspawn_env.value' will
refer to 'confspawn_env.env.value'. Defaults to
'less'.
usage: confspawn [-h] -c CONFIG -s TEMPLATE -t TARGET [-r] [-p PREFIX]
Easily build configuration files from templates.
examples:
confspawn -c ./config.toml -s ./foo/templates -t /home/me/target
optional arguments:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
File path for your TOML configuration file.
-s TEMPLATE, --template TEMPLATE
Template directory path where your configuration
templates are. Other files not indicated by prefix
will also be copied over. Does not traverse
subdirectories bt default.
-t TARGET, --target TARGET
Target directory path where your files will end up
(will be created if none exists, also overwrites
previous directory).
-r, --recurse Go through template directory recursively.
-p PREFIX, --prefix PREFIX
Prefix that indicates file is a configuration
template. Defaults to 'confspawn_' or the value of the
CONFSPAWN_PREFIX env var, if set.
-e ENV, --env ENV Useful to specify environment-related modes, i.e.
production or development. 'confspawn_env.value' will
refer to 'confspawn_env.env.value'. Defaults to
'less'.
usage: confrecipe [-h] -r RECIPE [-p PREFIX] [-e ENV]
Build multiple confspawn configurations using a recipe.
examples:
confrecipe -c ./config.toml -s ./foo/templates -t /home/me/target
optional arguments:
-h, --help show this help message and exit
-r RECIPE, --recipe RECIPE
File path for your TOML recipe file.
-p PREFIX, --prefix PREFIX
Prefix that indicates file is a configuration
template. Defaults to 'confspawn_' or the value of the
CONFSPAWN_PREFIX env var, if set.
-e ENV, --env ENV Overwrite env set in recipe. Defaults to 'None'.
The main entrypoints to use confspawn
programmatically are spawn_write()
(corresponds to the confspawn
command) and load_config_value()
(corresponds to the confenv
command). See the documentation for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
confspawn-0.6.0.tar.gz
(12.4 kB
view details)
Built Distribution
confspawn-0.6.0-py3-none-any.whl
(13.7 kB
view details)
File details
Details for the file confspawn-0.6.0.tar.gz
.
File metadata
- Download URL: confspawn-0.6.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1adbb9975a2ff0d7f1ca80cfa717ec06b9531ac65f503c2ba933a9d3d1a45e5f |
|
MD5 | d1f766c21b864d3cfbee48e479f5290a |
|
BLAKE2b-256 | 109845ff22ff8c27724c4f2b9d7767c340589dffef6cd98d73ee4b437e8d04d0 |
File details
Details for the file confspawn-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: confspawn-0.6.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54de7b705781e1d75c67a438c60d11db33d8fed004962b18bf55d55d49405934 |
|
MD5 | 16fec54eb923ff68180c6a39ba52ff00 |
|
BLAKE2b-256 | 4b052c3506f02764cfb3cd14a13201ebb980fbf6e9dacc39b88835f136e844e3 |