File tree 3 files changed +18
-12
lines changed
3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ require (
10
10
github.com/spf13/viper v1.19.0
11
11
github.com/stretchr/testify v1.9.0
12
12
golang.org/x/oauth2 v0.23.0
13
+ gorm.io/driver/postgres v1.5.9
13
14
gorm.io/gorm v1.25.12
14
15
)
15
16
@@ -68,5 +69,4 @@ require (
68
69
google.golang.org/protobuf v1.34.1 // indirect
69
70
gopkg.in/ini.v1 v1.67.0 // indirect
70
71
gopkg.in/yaml.v3 v3.0.1 // indirect
71
- gorm.io/driver/postgres v1.5.9 // indirect
72
72
)
Original file line number Diff line number Diff line change @@ -160,8 +160,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
160
160
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg =
161
161
google.golang.org/protobuf v1.34.1 /go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos =
162
162
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 =
165
165
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA =
166
166
gopkg.in/ini.v1 v1.67.0 /go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k =
167
167
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
Original file line number Diff line number Diff line change @@ -6,6 +6,14 @@ import (
6
6
"github.com/spf13/viper"
7
7
)
8
8
9
+ type Config struct {
10
+ ServerPort string
11
+ LogLevel string
12
+ EnablePolling bool
13
+ Database DatabaseConfig
14
+ GitHub GitHubConfig
15
+ }
16
+
9
17
type GitHubConfig struct {
10
18
ClientID string
11
19
ClientSecret string
@@ -21,14 +29,6 @@ type DatabaseConfig struct {
21
29
Port string
22
30
}
23
31
24
- type Config struct {
25
- ServerPort string
26
- LogLevel string
27
- EnablePolling bool
28
- Database DatabaseConfig
29
- GitHub GitHubConfig
30
- }
31
-
32
32
func LoadConfig () * Config {
33
33
viper .SetConfigName ("config" )
34
34
viper .SetConfigType ("yaml" )
@@ -54,6 +54,12 @@ func LoadConfig() *Config {
54
54
AccessToken : viper .GetString ("github.access_token" ),
55
55
WebhookSecret : viper .GetString ("github.webhook_secret" ),
56
56
},
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
+ },
58
64
}
59
65
}
You can’t perform that action at this time.
0 commit comments