Skip to content

Commit 298116d

Browse files
committed
add env config struct tags
1 parent 1abebe3 commit 298116d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

v2/internal/utopia/structs.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ type rateLimiters map[string]*rate.RateLimiter
1616

1717
type Config struct {
1818
// required
19-
Host string `json:"host" yaml:"host"` // default: 127.0.0.1
20-
Token string `json:"token" yaml:"token"`
21-
Port int `json:"port" yaml:"port"`
22-
WsPort int `json:"wsport" yaml:"wsport"`
19+
Host string `json:"host" yaml:"host" envconfig:"UTOPIA_HOST" default:"127.0.0.1"`
20+
Token string `json:"token" yaml:"token" envconfig:"UTOPIA_TOKEN"`
21+
Port int `json:"port" yaml:"port" envconfig:"UTOPIA_PORT" default:"22825"`
22+
WsPort int `json:"wsport" yaml:"wsport" envconfig:"UTOPIA_WS_PORT" default:"25000"`
2323

2424
// optional
25-
Protocol string `json:"protocol" yaml:"protocol"` // default: http
26-
RequestTimeoutSeconds int `json:"timeout" yaml:"timeout"`
25+
Protocol string `json:"protocol" yaml:"protocol" envconfig:"UTOPIA_PROTO" default:"http"`
26+
RequestTimeoutSeconds int `json:"timeout" yaml:"timeout" envconfig:"UTOPIA_CONN_TIMEOUT" default:"5000"`
2727
Cb LogCallback `json:"-" yaml:"-"`
2828
}
2929

0 commit comments

Comments
 (0)