Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] config and cleanup #617

Merged
merged 7 commits into from
Jan 3, 2017
Merged

Conversation

subfuzion
Copy link
Contributor

@subfuzion subfuzion commented Dec 30, 2016

Updated config loading precedence, modified config options, and performed minor cleanup.

$ make install-cli
$ amp
# note `--use-config` and `config-used` options

$ cp $HOME/.config/amp/amp.yaml .  # or create a new config
$ VERBOSE=true amp config ServerAddress "127.0.0.1:5000"
$ VERBOSE=true amp config ServerAddress
# output should indicate using using the project `amp.yaml`, not config in home directory;
# output should indicate ServerAddress is `127.0.0.1:5000`
$ cat ./amp.yaml  # output should also indicate ServerAddress is `127.0.0.1:5000`

$ cp ./amp.yaml ./amp2.yaml
$ amp --use-config ./amp2.yaml config ServerAddress localhost
$ amp --use-config ./amp2.yaml config ServerAddress
# verify ServerAddress == localhost
# cat `./amp2.yaml` and verify again

$ rm ./amp.yaml && rm ./amp2.yaml
$ amp config ServerAddress
# verify ServerAddress == `127.0.0.1:8080`
$ amp config ServerAddress localhost
$ amp config ServerAddress
# verify ServerAddress == localhost
# cat `$HOME/.config/amp/amp.aml` and verify again
$ amp config ServerAddress "127.0.0.1:8080"  # reset to original value

$ VERBOSE=true amp --use-config ./amp3.yaml config
# verify following output:
Warning: unable to load ./amp3.yaml, using default configuration

$ VERBOSE=true amp --use-config ./amp3.yaml config ServerAddress foobar
# verify following output:
foobar
$ cat ./amp3.yaml
# verify the file was created and ServerAddress is set to foobar
$ VERBOSE=true amp --use-config ./amp3.yaml config ServerAddress
# verify also displays foobar
$ rm ./amp3.yaml

@subfuzion subfuzion force-pushed the refactor05-fix-config-and-cleanup branch from 5d62b8e to 7e69b7a Compare December 30, 2016 21:11
Copy link
Contributor

@bquenin bquenin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@freignat91 freignat91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
tested ok, fixe a little typo in test description (.aml -> .yaml)

@freignat91 freignat91 merged commit f7b6a99 into master Jan 3, 2017
@freignat91 freignat91 deleted the refactor05-fix-config-and-cleanup branch January 3, 2017 14:06
@bquenin bquenin modified the milestone: 0.5.0 Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants