Add a --show-config option that prints the configuration to stdout or errors #317

Merged
merged 2 commits into from Nov 25, 2016

Projects

None yet

2 participants

@michaelkaye

I have recently deployed an invalid configuration of dynamic-dynamodb to production, and having taken a while to notice and work out what's going on, I started looking for a way to make my docker container build fail if the syntax of the configuration I've just changed is invalid, without having to do a --dry-run --run-once - which takes time if you have a lot of tables, and also needs access to the production systems (otherwise it'll return an error).

I thought it would also be useful to show the full configuration as cheap and cheerful json, as it's built up from the command line, configuration file and defaults, though the big benefit for me would be having the return code and the failure reason.

~/git-external/dynamic-dynamodb$ python dynamic-dynamodb --show-config || echo FAIL
{
  "tables": {}, 
  "global": {
    "circuit_breaker_url": null, 
    "daemon": false, 
    "aws_secret_access_key": null, 
    "dry_run": false, 
    "circuit_breaker_timeout": 10000.0, 
    "pid_file_dir": "/tmp", 
    "region": "us-east-1", 
    "show_config": true, 
    "run_once": false, 
    "instance": "default", 
    "check_interval": 300, 
    "config": null, 
    "aws_access_key_id": null
  }, 
  "logging": {
    "log_file": null, 
    "log_level": "info", 
    "log_config_file": null
  }
}

Or if I give it a broken configuration file:

~/git-external/dynamic-dynamodb$ python dynamic-dynamodb --show-config -c broken.conf || echo FAIL
Could not find a [table: <table_name>] section in broken.conf
FAIL
@sebdah sebdah merged commit 442a5b3 into sebdah:master Nov 25, 2016
@sebdah
Owner
sebdah commented Nov 25, 2016

Thanks for the PR. This is now live in version 2.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment