@@ -8,17 +8,18 @@ import (
8
8
)
9
9
10
10
type Config struct {
11
- Log LogConfig `mapstructure:"log"`
12
- HTTP HTTPConfig `mapstructure:"http"`
13
- AdminPassword string `mapstructure:"admin_password"`
14
- PG PGConfig `mapstructure:"pg"`
15
- MQ MQConfig `mapstructure:"mq"`
16
- RAG RAGConfig `mapstructure:"rag"`
17
- Redis RedisConfig `mapstructure:"redis"`
18
- Auth AuthConfig `mapstructure:"auth"`
19
- S3 S3Config `mapstructure:"s3"`
20
- CaddyAPI string `mapstructure:"caddy_api"`
21
- SubnetPrefix string `mapstructure:"subnet_prefix"`
11
+ Log LogConfig `mapstructure:"log"`
12
+ HTTP HTTPConfig `mapstructure:"http"`
13
+ AdminPassword string `mapstructure:"admin_password"`
14
+ PG PGConfig `mapstructure:"pg"`
15
+ MQ MQConfig `mapstructure:"mq"`
16
+ RAG RAGConfig `mapstructure:"rag"`
17
+ Redis RedisConfig `mapstructure:"redis"`
18
+ Auth AuthConfig `mapstructure:"auth"`
19
+ S3 S3Config `mapstructure:"s3"`
20
+ Sentry SentryConfig `mapstructure:"sentry"`
21
+ CaddyAPI string `mapstructure:"caddy_api"`
22
+ SubnetPrefix string `mapstructure:"subnet_prefix"`
22
23
}
23
24
24
25
type LogConfig struct {
@@ -74,6 +75,11 @@ type S3Config struct {
74
75
SecretKey string `mapstructure:"secret_key"`
75
76
}
76
77
78
+ type SentryConfig struct {
79
+ Enabled bool `mapstructure:"enabled"`
80
+ DSN string `mapstructure:"dsn"`
81
+ }
82
+
77
83
func NewConfig () (* Config , error ) {
78
84
// set default config
79
85
SUBNET_PREFIX := os .Getenv ("SUBNET_PREFIX" )
@@ -119,6 +125,10 @@ func NewConfig() (*Config, error) {
119
125
AccessKey : "s3panda-wiki" ,
120
126
SecretKey : "" ,
121
127
},
128
+ Sentry : SentryConfig {
129
+ Enabled : false ,
130
+ DSN : "" ,
131
+ },
122
132
CaddyAPI : "/app/run/caddy-admin.sock" ,
123
133
SubnetPrefix : "169.254.15" ,
124
134
}
@@ -190,6 +200,13 @@ func overrideWithEnv(c *Config) {
190
200
if env := os .Getenv ("S3_ENDPOINT" ); env != "" {
191
201
c .S3 .Endpoint = env
192
202
}
203
+ // sentry
204
+ if env := os .Getenv ("SENTRY_ENABLED" ); env != "" {
205
+ c .Sentry .Enabled = env == "true"
206
+ }
207
+ if env := os .Getenv ("SENTRY_DSN" ); env != "" {
208
+ c .Sentry .DSN = env
209
+ }
193
210
}
194
211
195
212
func (* Config ) GetString (key string ) string {
0 commit comments