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

Migrate from ENV to YAML config #59

Merged
merged 26 commits into from
Jan 27, 2024
Merged

Migrate from ENV to YAML config #59

merged 26 commits into from
Jan 27, 2024

Conversation

No767
Copy link
Member

@No767 No767 commented Jan 26, 2024

Summary

This PR addresses the migration from using an ENV file as an config to YAML. The rationale for moving is that it's hard to work with ENV files, and as pointed by Diamond, an ENV file is not an config. ENV files only store strings, so it makes it hacky to try and implement values that are required to be int or bool. For this project, environs was used to bypass this hacky behavior by serializing the key value pairs into native Python types through Marshmallow. This puts an burden on the original problem, which is the format itself. After considering many other formats (including JSON and TOML), YAML was selected as there is an yaml parser library through PyYAML (w/ libyaml bindings), and YAML is a superset of JSON. This makes it easier to understand, as platforms such as GitHub already use YAML extensively, and it's very easy to pick up and learn. Migration should not be hard. In addition, the config system is written in a way where it would be trivial to swap to another config format, such as TOML as all is needed to change is the parser within RodhajConfig.load_from_file

This PR also adjusts the Docker Compose settings to use an custom ENV file instead.

Namely, some tasks that need to be dealt with before merging are noted:

  • Implement config system
  • Remove old ENV configs
  • Provide YAML config example
  • Write migration documentation

Types of changes

What types of changes does your code introduce to Rodhaj
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (Updates to README.md, the documentation, etc)
  • Other (if none of the other choices apply)

Checklist

Put an x in the boxes that apply

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes. (if appropriate)
  • All workflows (except pre-commit.ci) pass with my new changes
  • This PR does not address a duplicate issue or PR

@No767 No767 marked this pull request as ready for review January 27, 2024 18:26
Copy link

sonarcloud bot commented Jan 27, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@No767 No767 merged commit 6035020 into main Jan 27, 2024
9 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.

1 participant