Skip to content

Commit ef7bfc1

Browse files
Alec CunninghamAlec Cunningham
Alec Cunningham
authored and
Alec Cunningham
committed
chore: fix config
1 parent b6c287e commit ef7bfc1

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/spf13/viper v1.19.0
1111
github.com/stretchr/testify v1.9.0
1212
golang.org/x/oauth2 v0.23.0
13+
gorm.io/driver/postgres v1.5.9
1314
gorm.io/gorm v1.25.12
1415
)
1516

@@ -68,5 +69,4 @@ require (
6869
google.golang.org/protobuf v1.34.1 // indirect
6970
gopkg.in/ini.v1 v1.67.0 // indirect
7071
gopkg.in/yaml.v3 v3.0.1 // indirect
71-
gorm.io/driver/postgres v1.5.9 // indirect
7272
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
160160
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
161161
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
162162
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
163-
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
164-
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
163+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
164+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
165165
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
166166
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
167167
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

pkg/config/config.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import (
66
"github.com/spf13/viper"
77
)
88

9+
type Config struct {
10+
ServerPort string
11+
LogLevel string
12+
EnablePolling bool
13+
Database DatabaseConfig
14+
GitHub GitHubConfig
15+
}
16+
917
type GitHubConfig struct {
1018
ClientID string
1119
ClientSecret string
@@ -21,14 +29,6 @@ type DatabaseConfig struct {
2129
Port string
2230
}
2331

24-
type Config struct {
25-
ServerPort string
26-
LogLevel string
27-
EnablePolling bool
28-
Database DatabaseConfig
29-
GitHub GitHubConfig
30-
}
31-
3232
func LoadConfig() *Config {
3333
viper.SetConfigName("config")
3434
viper.SetConfigType("yaml")
@@ -54,6 +54,12 @@ func LoadConfig() *Config {
5454
AccessToken: viper.GetString("github.access_token"),
5555
WebhookSecret: viper.GetString("github.webhook_secret"),
5656
},
57-
// Initialize other fields...
57+
Database: DatabaseConfig{
58+
Host: viper.GetString("database.host"),
59+
User: viper.GetString("database.user"),
60+
Password: viper.GetString("database.password"),
61+
DBName: viper.GetString("database.db_name"),
62+
Port: viper.GetString("database.port"),
63+
},
5864
}
5965
}

0 commit comments

Comments
 (0)