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

feat(golang-rewrite): add config methods #24

Merged
merged 1 commit into from
Feb 21, 2024
Merged

Conversation

Stratus3D
Copy link
Member

@Stratus3D Stratus3D commented Feb 21, 2024

  • Create PluginRepoCheckDuration struct to represent config value
  • Make some functions private
  • Write methods for loading settings on Config struct
  • Write basic tests for Config methods

TODO

  • Figure out better methods and/or interface for config in general.
    • Do I define one interface with a method for every config field? Or one interface for each config field?
    • I want to have something that makes it easy to inject test config into any other code in the application.

type PluginRepoCheckDuration struct {
Never bool
Every int
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not confident this is the way to go, but it works. Any user of this just needs to know that Every should only be used when Never is set to false.

@@ -61,7 +139,7 @@ func loadConfigEnv() (Config, error) {
return config, err
}

func LoadSettings(asdfrcPath string) (Settings, error) {
func loadSettings(asdfrcPath string) (Settings, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason for this to be public.

}, nil
}

func YesNoToBool(section *ini.Section, key string, defaultValue bool) bool {
func yesNoToBool(section *ini.Section, key string, defaultValue bool) bool {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason for this to be public.

* Create PluginRepoCheckDuration struct to represent config value
* Make some functions private
* write basic tests for Config methods
* Add Loaded field to Settings struct
* Define constants for config default values
@Stratus3D Stratus3D merged commit da9f842 into master Feb 21, 2024
7 of 9 checks passed
@Stratus3D Stratus3D deleted the tb/config-api branch February 21, 2024 14:20
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