-
Notifications
You must be signed in to change notification settings - Fork 140
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
Refactor configuration #304
Comments
Came here to open this. Looks like some of it resolved in #315 yesterday, but there are still discrepancies related to |
Yooooo that is awesome work. Yeah I think I'd still like to see the following
Maybe a few other things. But perhaps we should make little issues for each? |
That sounds good. I'm wondering how the nested structure on config file you provided will play with viper.. maybe separating with a dot like |
The nested structure on the config file works with viper (I've done this multiple times in other projects) so that e.g
The one I don't know about is automagically mapping that to |
Here is example without that cool flag behavior in one my projects https://github.com/nsmith5/rekor-sidekick/blob/main/cli.go#L28-L57 |
Perhaps it was one of these projects used for that flag thing |
I am happy to park 1.0 for this , but first does anyone plan to work on this and what would be the ETA? |
I can take this unless @jdolitsky wants to or already has started work (happy to collab too!). I've got a bunch of bandwidth to make this happen starting on Thursday. I think it would take me ~1 week with code review and all the pipeline breakage it will cause |
@nsmith5 go for it - I'll reach out on slack and see if theres anything to help with there |
@lukehinds @jdolitsky I totally over estimated my skills and underestimated how much of a refactor this would be. I've had a poke at this but it feels like a bit of a task. The configuration code is fairly tightly coupled to other things around the code base so its a little challenging to refactor configuration with having to refactor all of those. Here is an example You can see that the configuration of OIDC providers is coupled to caching of issuer verifiers in a LRU. Perhaps someone else would be able to set this on the right path quickly, but I don't think I've got the chops for it. One other approach might be worth thinking about:
Limme know what ya'll think :D |
I agree and let's to do this later. A big refactor right before a major release is inviting problems, so you're wise to call this. |
Issue
Fulcio configuration is a bit of an inconsistent experience right now for the end user and as a developer. From an operator perspective:
_
versus-
as a seperator (e.g--ct-log-url
vs--gcp_private_ca_parent
)From a developer perspective we make calls to directly to
viper.GetString("flag-name")
to get config. Because of the dynamic nature of that call it means you need to keep track that this data was validated previously. For example:--fileca-cert
herePotential Solutions / Improvements
From an operator perspective its nice when you can use config file, flag or env var to achieve the same thing. Eg. with a configuration file like
You can set an flag like
--server.port=3003
or set env varFULCIO_SERVER_PORT=3003
for example to modify the port.From a developer perspective we load this configuration and validate data once on start up and then just pass the confige struct down into each component or via context stuffing. This could look like e.g
To bind the config options to environment variables we can use
viper.AutomaticEnv()
and to bind all the flags we can useviper.BindPFlags()
.Pros:
Cons:
The text was updated successfully, but these errors were encountered: