diff --git a/cmd/pm/runner.go b/cmd/pm/runner.go index e4c6ad7..9635162 100644 --- a/cmd/pm/runner.go +++ b/cmd/pm/runner.go @@ -37,12 +37,12 @@ func runStartCmd(cmd *cobra.Command, args []string) error { for { - if app.Config.DB_URI == "" { + if app.Config.DbUri == "" { cmd.Println("No database URI provided in environment, survey responses will not be submitted.") break } - db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DB_URI) + db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DbUri) if err == nil { mongoStorage = db break diff --git a/internal/commands/survey/submit.go b/internal/commands/survey/submit.go index 51ef9ef..41b284f 100644 --- a/internal/commands/survey/submit.go +++ b/internal/commands/survey/submit.go @@ -17,12 +17,12 @@ var SubmitCmd = &cobra.Command{ return fmt.Errorf("application context not initialized") } - if app.Config.DB_URI == "" { + if app.Config.DbUri == "" { cmd.Println("No database URI provided in environment, survey responses will not be submitted.") return nil } - db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DB_URI) + db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DbUri) if err != nil { return fmt.Errorf("failed to connect to database: %w", err) } diff --git a/internal/models/config.go b/internal/models/config.go index a2c788d..9dbd45e 100644 --- a/internal/models/config.go +++ b/internal/models/config.go @@ -3,7 +3,7 @@ package models import "os" type Config struct { - DB_URI string + DbUri string AutoInit bool RootCmd string WebAddress string @@ -14,7 +14,7 @@ type Config struct { } var BaseConfig = Config{ - DB_URI: "", + DbUri: "", AutoInit: false, RootCmd: "pm", IssuePrefix: "pm", @@ -24,12 +24,12 @@ var BaseConfig = Config{ } func (c Config) LoadFromEnv() Config { - c.DB_URI = os.Getenv("DB_URI") + c.DbUri = os.Getenv("DB_URI") return c } -func (c Config) WithDB_URI(uri string) Config { - c.DB_URI = uri +func (c Config) WithDbUri(uri string) Config { + c.DbUri = uri return c }