-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add expansion feature #37
Conversation
This PR would not affect the old yaml setting. It only reads the |
Read dotenv file and expand based on env and system env
fb642b9
to
ee589d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend to allow user to override dotenv
path in cli parameter and init_cluster
parameter. it'll be more flexible for user to handle path issues.
The |
I'll try override dotenv path in cli. |
After crypto-com/pystarport#37, would change back to crypto-com/pystarport.
I suggest don't expand at all when |
Yes, it is what it can do now. It is very simple, just one if statement. https://github.com/crypto-com/pystarport/pull/37/files#diff-aa7a1723d585e834919ecbcc08a9aacad7402b6d0dc1a1f5b478ad17c44657b5R911. And I will add cli support as well. |
1. `--dotenv`: an optional cli option for overriding the dotenv option in yaml file 2. move the expansion codes to expansion.py and handle it in `expand_yaml`
This pull request introduces 2 alerts when merging f17ff16 into a127111 - view on LGTM.com new alerts:
|
To make diff easy.
261b008
to
946d5e9
Compare
This pull request introduces 2 alerts when merging 946d5e9 into a127111 - view on LGTM.com new alerts:
|
After crypto-com/pystarport#37, would change back to crypto-com/pystarport.
23fbc32
to
5948b55
Compare
After crypto-com/pystarport#37, would change back to crypto-com/pystarport.
Please check the test result here: https://github.com/damoncro/pystarport/runs/4391700415?check_suite_focus=true |
It is ready to merge. Please check the test result: https://github.com/crypto-com/pystarport/runs/4391781936?check_suite_focus=true |
pyproject.toml
Outdated
@@ -22,6 +22,9 @@ supervisor = "^4.2.1" | |||
docker = "^4.3.1" | |||
bech32 = "^1.1.0" | |||
multitail2 = "^1.5.2" | |||
python-dotenv = "^0.19.2" | |||
deepdiff = "^5.6.0" | |||
pytest = "^6.2.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be in the dev-dependencies
?
pystarport/cluster.py
Outdated
@@ -902,9 +903,9 @@ def relayer_chain_config(data_dir, chain, relayer_chains_config): | |||
|
|||
|
|||
def init_cluster( | |||
data_dir, config_path, base_port, image=IMAGE, cmd=None, gen_compose_file=False | |||
data_dir, config_path, base_port, dotenv, image=IMAGE, cmd=None, gen_compose_file=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data_dir, config_path, base_port, dotenv, image=IMAGE, cmd=None, gen_compose_file=False | |
data_dir, config_path, base_port, dotenv=None, image=IMAGE, cmd=None, gen_compose_file=False |
to keep it backward compatible.
pystarport/cluster.py
Outdated
@@ -1095,7 +1096,7 @@ def format_value(v, ctx): | |||
if __name__ == "__main__": | |||
interact("rm -r data; mkdir data", ignore_error=True) | |||
data_dir = Path("data") | |||
init_cluster(data_dir, "config.yaml", 26650) | |||
init_cluster(data_dir, "config.yaml", 26650, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init_cluster(data_dir, "config.yaml", 26650, None) | |
init_cluster(data_dir, "config.yaml", 26650) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, only minor suggestions, and could you add a changelog item.
Good |
It is more general and backward compatible.
…tests (#233) * Add .env * Load dotenv and expand it in all related files 1. Scritps 2. yaml 3. Python files * Update to read full path of config files * Test: Replace with test pystarport at first After crypto-com/pystarport#37, would change back to crypto-com/pystarport. * Test expansion Test the expansion feature * Update the test pystarport * Update test pystarport * Update test_expansion * Move the test_expansion to pystarport * Back to crypto-com/pystarport@main and remove deepdiff dependency. * Use Path to get path It is more general and work with full path as well * Use full path of .env * Use pystarport v0.2.3 * Override dotenv in start-cronos/start-chainmain This makes these two script-bins defined in `scripts.nix` always use the same yaml and dotenv file, for metting the "re-producibility" requirement during one/same `nix-shell` environment. These script-bins are wrappers of pystarport with fixed yaml and dotenv. If you want to create the cronos/chainmain instance with different configurations, you should avoid using the script-bins. Please run the scripts directly, or use `pystarport` step by step. Besides, if you change the yaml or dotenv, you need to exit and re-enter the nix-shell. So that the modified yaml or dotenv are copied to nix store, and their paths can be rewritten into these two script-bins.
Expand .env if specified in yaml configuration