@@ -24,8 +24,7 @@ type SentryConfiguration struct {
24
24
}
25
25
26
26
type ServerConfiguration struct {
27
- Environment string `json:"environment"`
28
- HTTP struct {
27
+ HTTP struct {
29
28
Port uint32 `json:"port"`
30
29
} `json:"http"`
31
30
}
@@ -88,6 +87,7 @@ type Configuration struct {
88
87
Strategy StrategyConfiguration `json:"strategy"`
89
88
Signature SignatureConfiguration `json:"signature"`
90
89
SMTP SMTPConfiguration `json:"smtp"`
90
+ Environment string `json:"env"`
91
91
DisableEndpoint bool `json:"disable_endpoint"`
92
92
}
93
93
@@ -96,6 +96,10 @@ type QueueProvider string
96
96
type StrategyProvider string
97
97
type SignatureHeaderProvider string
98
98
99
+ const (
100
+ DevelopmentEnvironment string = "development"
101
+ )
102
+
99
103
const (
100
104
NoAuthProvider AuthProvider = "none"
101
105
BasicAuthProvider AuthProvider = "basic"
@@ -145,13 +149,13 @@ func LoadConfig(p string) error {
145
149
}
146
150
}
147
151
148
- if serverEnv := os .Getenv ("CONVOY_SERVER_ENV " ); serverEnv != "" {
149
- c .Server . Environment = serverEnv
152
+ if env := os .Getenv ("CONVOY_ENV " ); env != "" {
153
+ c .Environment = env
150
154
}
151
155
152
156
// if it's still empty, set it to development
153
- if c .Server . Environment == "" {
154
- c .Server . Environment = "development"
157
+ if c .Environment == "" {
158
+ c .Environment = DevelopmentEnvironment
155
159
}
156
160
157
161
if sentryDsn := os .Getenv ("CONVOY_SENTRY_DSN" ); sentryDsn != "" {
@@ -240,6 +244,12 @@ func LoadConfig(p string) error {
240
244
241
245
}
242
246
247
+ if e := os .Getenv ("CONVOY_DISABLE_ENDPOINT" ); e != "" {
248
+ if d , err := strconv .ParseBool (e ); err != nil {
249
+ c .DisableEndpoint = d
250
+ }
251
+ }
252
+
243
253
c .UIAuthorizedUsers = parseAuthorizedUsers (c .UIAuth )
244
254
245
255
cfgSingleton .Store (c )
0 commit comments