-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.go
More file actions
35 lines (24 loc) · 766 Bytes
/
config.go
File metadata and controls
35 lines (24 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"github.com/rs/zerolog/log"
"go-simpler.org/env"
)
type Config struct {
BotToken string `env:"TELEGRAM_BOT_TOKEN"`
AdminToken string `env:"ADMIN_TOKEN"`
BangumiAppId string `env:"BGM_TV_APP_ID"`
BangumiAppSecret string `env:"BGM_TV_APP_SECRET"`
ExternalHttpAddress string `env:"EXTERNAL_HTTP_ADDRESS" default:"http://127.0.0.1:4562"`
Port uint16 `env:"PORT" default:"4562"`
RedisDsn string `env:"REDIS_DSN"`
PgDsn string `env:"PG_DSN"`
Debug bool `env:"DEBUG" default:"false"`
TurnstileSiteKey string `env:"TURNSTILE_SITE_KEY"`
TurnstileSecretKey string `env:"TURNSTILE_SECRET_KEY"`
}
func newConfig() (Config, error) {
var cfg Config
log.Info().Msg("load config")
err := env.Load(&cfg, nil)
return cfg, err
}