-
Notifications
You must be signed in to change notification settings - Fork 22
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
Remove viper for cleanenv #258
Conversation
The "Rename clowder service to 'api'" commit was pushed accidentally, will remove. |
6302a28
to
41249ef
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 wonder why We need different config file for api/worker, I guess most configuration in development is identical, right?
But I'm fine eighter way, it just means I need to define my DB three times, its inconvenient, but I can live with it 🤷
Apart of that 💘 it
Please do not merge, still working on refactoring those useless config and improving some others. Well it seems logical to me, in clowder env you also have separate configs so I thought it's a reasonable to have this for development too. I can implement fallback, if |
I pushed a new version which removes EXIT_ON_PANIC (it was useless the app should never exit) and removes environment in favour or helper methods |
I will push new commits from now on, sorry, I haven't realized you started reviewing. The patch is smaller than I expected tho. |
Just to let you know, those amended commits - I am just trying to break the CI so I can actually see the value in clowder.Metadata.Env variable, I guess it could be something like "ephemeral" but I need to confirm this :) |
Ah we do NOT use HTTP proxy when in clowder, so it's even more simple, I do not need any |
Ok removed, @ezr-ondrej how about this? I will only convert logger to string and heartbeat to time.Duration in separate commits. |
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.
Nice, great refactoring, much easier to read then viper :)
The files make sense, I'd expect one main and then per-process, but api
is kinda the main one, right?
Tho shouldn't the api go first in the calls? now if the var is set in worker and api, the api will win for worker, right? :)
Yeah I refactored and changed the order, initially I thought it is not possible to override values but looks like it does work. |
Done, this is now ready for the final review and testing. Had to rebase one more time, there was a typo If you want, I can rename the directory in another commit since people will have to update their configuration files anyway, it will be more disturbing change tho (makefile changes likely). Not a huge deal tho, two dozens of lines. |
If it's not as big, I'd be for singular as well... I've messed up few times already as well EDIT: Just keep in mind |
Yeah but sources-api-go use |
Added a new commit with renamed configuration directory. |
Needs rebase, but I wonder how we should anounce these breaking changes to devel env? 🤔 shall we compose some list of recent changes in the repo? So devs who were away for a while can go to that list? |
Will do, please merge this one first before these: There will be conflicts and this one is pain to rebase (multiple commits). |
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.
The app starts, connects to DB and conects to AWS.
Thanks 👍 nice cleanup :)
Complete rewrite of our config handling. Configuration is now done via
configs/api.env
(pbapi),configs/worker.env
(pbworker) andconfigs/test.env
(integration tests). There is alsoconfigs/example.env
file which is generated via a new makefile targetgenerate-example-config
.Everything, literally everything is now defined in a single file
internal/config/config.go
- the whole structure, types, env variable name, default value and also optionally description.ACTION NEEDED: New configuration needs to be deployed for development setups. There should be no changes needed for Clowder, except if we have a typo in an environmental variable.
Do not merge, this is the first cut. I will fix bugs and after review I would like to do few more TODO comments which is a small refactoring which leads from my review of all values. I want to do this in a single PR so people don't need to update configuration multiple times as I want to rename and move few around.