Skip to content

Conversation

@mostafa
Copy link
Member

@mostafa mostafa commented Jan 6, 2023

In this PR I moved the config_parser.go from the cmd package into its own config package. I extracted almost all of the constants from all packages into the config/constants.py and referenced them in packages from there and introduced new types (structs) to unmarshal konaf configs (global and plugin configs) into those structs for easier access. I also added getters for certain fields, which had more complex types.

Closes #73.

mostafa added 13 commits January 5, 2023 15:29
Add config structs to dump consolidated config into them for easier access
Extract (almost) all the constants in all the packages into config/constants.go
Add getter functions for some fields with validations
Add NewLoggerWithBuffer function to use for testing
Align Server struct
Default config values are very important, that's why we should panic.
Use the new config struct for setting up new objects
Load default global and plugin config before loading config files
Unmarshal koanf object into structs for easier access
Use "default" config for initializing GatewayD objects
@mostafa mostafa force-pushed the unmarshal-configs-into-structs branch from 91fb7c9 to d99c2cd Compare January 6, 2023 14:15
@mostafa mostafa merged commit 9cfb588 into main Jan 6, 2023
@mostafa mostafa deleted the unmarshal-configs-into-structs branch January 6, 2023 14:23
mostafa added a commit that referenced this pull request Jan 29, 2023
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.

Improve config parser by using unmarshaling into structs

2 participants