diff --git a/config/config.go b/config/config.go index 08cc27e..48b8773 100644 --- a/config/config.go +++ b/config/config.go @@ -13,7 +13,7 @@ import ( var CFG Config type Config struct { - Dsn string `yaml:"dsn"` + PostgresqlDsn string `yaml:"postgresql_dsn"` LogFile string `yaml:"log_file"` JWTSigningString string `yaml:"jwt_signing_string"` RedisDsn string `yaml:"redis_dsn"` @@ -31,7 +31,7 @@ func ReadConfig() (*Config, error) { } config := &Config{ - Dsn: "host=localhost user=postgres password=1234 dbname=API_BIG_WORK port=5432 sslmode=disable", + PostgresqlDsn: "host=localhost user=postgres password=1234 dbname=API_BIG_WORK port=5432 sslmode=disable", LogFile: "log.txt", JWTSigningString: GenerateRandomString(32), RedisDsn: "localhost:6379", diff --git a/models/init.go b/models/init.go index e50b0e8..d0c8c19 100644 --- a/models/init.go +++ b/models/init.go @@ -61,7 +61,7 @@ func InitDB(cfg *config.Config) { var db *gorm.DB var err error if config.Postgresql { - db, err = postgresDB(cfg.Dsn, &gorm.Config{}) + db, err = postgresDB(cfg.PostgresqlDsn, &gorm.Config{}) } else { db, err = sqliteDB(&gorm.Config{}) }