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

feat: world.toml config file and set namespace #16

Merged
merged 9 commits into from
Nov 28, 2023

Conversation

jerargus
Copy link
Contributor

@jerargus jerargus commented Nov 17, 2023

Closes: #WORLD-574

What is the purpose of the change

Make it possible to drive world-cli via a configuration file. world-cli checks for configuration files in the following order:

  1. a flag: --config=/path/to/some/file
  2. an environment variable: WORLD_CLI_CONFIG_FILE=/path/to/some/file
  3. a file called "world.toml" in the current directory
  4. a file called "world.toml" in the parent directory (or its parent directory, etc...)

In the current iteration of this code, key/value pairs in the toml files are interpreted as environment variables and passed directly to the docker-compose command.

This starter-game-template-pr: Argus-Labs/starter-game-template#31 includes a sample config file.

Testing and Verifying

There are unit tests to verify the loading and parsing of

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (fd8c647) 23.52% compared to head (9547c7f) 57.14%.

❗ Current head 9547c7f differs from pull request most recent head 1ec7758. Consider uploading reports for the commit 1ec7758 to get more accurate results

Files Patch % Lines
common/config/config.go 88.88% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #16       +/-   ##
===========================================
+ Coverage   23.52%   57.14%   +33.61%     
===========================================
  Files           3        4        +1     
  Lines          51      105       +54     
===========================================
+ Hits           12       60       +48     
- Misses         39       43        +4     
- Partials        0        2        +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jerargus jerargus marked this pull request as ready for review November 17, 2023 19:01
@smsunarto smsunarto changed the title Jer/use config file and set namespace feat: world.toml config file and set namespace Nov 19, 2023
Copy link
Contributor

@technicallyty technicallyty 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 it might be kinda nice to have toml headers for the specific resource you're configuring. something like:

[evm]
DA_AUTH_TOKEN=blah
BLAH=BLAH

[cardinal]
CARDINAL_NAMESPACE=BLAH

@smsunarto
Copy link
Member

i think it might be kinda nice to have toml headers for the specific resource you're configuring. something like:

[evm]
DA_AUTH_TOKEN=blah
BLAH=BLAH

[cardinal]
CARDINAL_NAMESPACE=BLAH

yeah lets do this, we might actually need this because we might have multiple different cardinal game projects in the same repo that needs different configs.

Copy link
Contributor

@technicallyty technicallyty left a comment

Choose a reason for hiding this comment

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

looks good. can we throw an example.toml in the root? i see its in the starter-template but would be nice to have here just for reference, and even testing

@jerargus jerargus merged commit c30d024 into main Nov 28, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants