use correct naming convension

This commit is contained in:
Robin Olsen
2026-03-10 13:33:12 +01:00
parent ce4c815ef5
commit df0bdb9918
3 changed files with 9 additions and 9 deletions

View File

@@ -37,12 +37,12 @@ func runStartCmd(cmd *cobra.Command, args []string) error {
for { for {
if app.Config.DB_URI == "" { if app.Config.DbUri == "" {
cmd.Println("No database URI provided in environment, survey responses will not be submitted.") cmd.Println("No database URI provided in environment, survey responses will not be submitted.")
break break
} }
db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DB_URI) db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DbUri)
if err == nil { if err == nil {
mongoStorage = db mongoStorage = db
break break

View File

@@ -17,12 +17,12 @@ var SubmitCmd = &cobra.Command{
return fmt.Errorf("application context not initialized") 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.") cmd.Println("No database URI provided in environment, survey responses will not be submitted.")
return nil return nil
} }
db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DB_URI) db, err := storage.NewMongoStorageInteractive(cmd.Context(), app.Config.DbUri)
if err != nil { if err != nil {
return fmt.Errorf("failed to connect to database: %w", err) return fmt.Errorf("failed to connect to database: %w", err)
} }

View File

@@ -3,7 +3,7 @@ package models
import "os" import "os"
type Config struct { type Config struct {
DB_URI string DbUri string
AutoInit bool AutoInit bool
RootCmd string RootCmd string
WebAddress string WebAddress string
@@ -14,7 +14,7 @@ type Config struct {
} }
var BaseConfig = Config{ var BaseConfig = Config{
DB_URI: "", DbUri: "",
AutoInit: false, AutoInit: false,
RootCmd: "pm", RootCmd: "pm",
IssuePrefix: "pm", IssuePrefix: "pm",
@@ -24,12 +24,12 @@ var BaseConfig = Config{
} }
func (c Config) LoadFromEnv() Config { func (c Config) LoadFromEnv() Config {
c.DB_URI = os.Getenv("DB_URI") c.DbUri = os.Getenv("DB_URI")
return c return c
} }
func (c Config) WithDB_URI(uri string) Config { func (c Config) WithDbUri(uri string) Config {
c.DB_URI = uri c.DbUri = uri
return c return c
} }