Skip to content

Conversation

@sriram-mv
Copy link
Contributor

@sriram-mv sriram-mv commented Nov 5, 2019

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sriram-mv sriram-mv force-pushed the config_file branch 2 times, most recently from 25307ea to 5cca4c3 Compare November 5, 2019 06:53
@sriram-mv
Copy link
Contributor Author

Integration tests are working locally, need to investigate appveyor gates. Unrelated PR: #1501 is experiencing similar issues.

@sriram-mv sriram-mv force-pushed the config_file branch 2 times, most recently from 61b79d6 to 417b857 Compare November 10, 2019 20:35
@sriram-mv
Copy link
Contributor Author

open to modification of --identifier. it could be environment, mode, config.

Copy link
Contributor

@awood45 awood45 left a comment

Choose a reason for hiding this comment

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

I think this is well-formed, assuming the design stays in line. Before shipping, I'd want to see functional or integration tests which integrate config file fixtures against real commands.

@sriram-mv
Copy link
Contributor Author

@awood45 thanks for the review! yes those tests will be added in next series of commits.

Copy link
Contributor

@sanathkr sanathkr left a comment

Choose a reason for hiding this comment

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

Also, add the config file option to generate-event command as well

Copy link
Contributor

Choose a reason for hiding this comment

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

i guess this will be changed to samconfig.toml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

  • What happens if the file does not exist?
  • What happens if the TOML file cannot be parsed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are checks for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we print a error message to customers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to error, although might be polluting if they choose not to use a config file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Quick line explaining what the method does?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this param a string or pathlib?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its a string. understandable by os.path, can change to pathlib

Copy link
Contributor

Choose a reason for hiding this comment

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

How is default added to param?

Copy link
Contributor

Choose a reason for hiding this comment

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

so this os.path.abspath again here is dangerous. It is a good practice to do relative->absolute path conversion once because it's tricky getting the right cwd

- add passthroughs to the CLI command line interface via a configuration
  file
- local defaults are set at: `.aws-sam/samconfig.toml`
- This commit contains code copied and modified from https://github.com/phha/click_config_file/blob/master/click_config_file.py under MIT license
- descope environment variables
- move samconfig.toml back to project root
@sriram-mv sriram-mv changed the base branch from develop to release-v0.32.0 November 14, 2019 07:55
Copy link
Contributor

@sanathkr sanathkr left a comment

Choose a reason for hiding this comment

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

LGTM

@sriram-mv sriram-mv merged commit b2f4cf2 into aws:release-v0.32.0 Nov 15, 2019
sriram-mv added a commit that referenced this pull request Nov 20, 2019
* feat: configuration file for sam cli commands

- add passthroughs to the CLI command line interface via a configuration
  file
- local defaults are set at: `.aws-sam/samconfig.toml`
- This commit contains code copied and modified from https://github.com/phha/click_config_file/blob/master/click_config_file.py under MIT license

* fix: add identifier name argument instead of configuration files.

* rework: change command key construction logic

- descope environment variables
- move samconfig.toml back to project root

* docstring: TomlProvider class

* fix: allow spaces on certain deploy options

* fix: REGEX for parameter overrides

* fix: infer config path name from ctx

* fix: set abs path to `ctx.config_path`

* fix: set dirname for config_path not template file name.
sriram-mv added a commit that referenced this pull request Nov 23, 2019
* feat: configuration file for sam cli commands

- add passthroughs to the CLI command line interface via a configuration
  file
- local defaults are set at: `.aws-sam/samconfig.toml`
- This commit contains code copied and modified from https://github.com/phha/click_config_file/blob/master/click_config_file.py under MIT license

* fix: add identifier name argument instead of configuration files.

* rework: change command key construction logic

- descope environment variables
- move samconfig.toml back to project root

* docstring: TomlProvider class

* fix: allow spaces on certain deploy options

* fix: REGEX for parameter overrides

* fix: infer config path name from ctx

* fix: set abs path to `ctx.config_path`

* fix: set dirname for config_path not template file name.
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.

4 participants