spirit-labs / tektite

Tektite DB
http://www.tektitedb.com
Apache License 2.0
116 stars 16 forks source link

Use pointer to type in config to represent unset config setting #36

Open purplefox opened 2 months ago

purplefox commented 2 months ago

Currently in conf.Config.ApplyDefaults() we apply the defaults if the current value is the zero value of the type, e.g. zero or empty string. However this does not work well for config settings that can legitimately have the zero value as a configured value.

Instead we can refactor Config so that it maintains pointer to the type not the type itself, then if the value is nil it has not been set and we can apply defaults.

E.g. instead of:

type Config struct {
   ...
   MinioBucketName string
   MinioSecure     bool
    ...
}

Have:

type Config struct {
   ...
   MinioBucketName *string
   MinioSecure     *bool
    ...
}
hxalid commented 1 month ago

Hi @purplefox - thank you for open sourcing this project. It looks super interesting and I would like to contribute as well. I saw a discussion in another issue and you recommended new joiners to start with a "good first issue". If there is no objection me joining the project please assign this issue to me.

purplefox commented 1 month ago

Hey @hxalid welcome, and thanks for your interest! Yes, you're more than welcome to take this task. Any questions pls start a discussion.