/
config.go
90 lines (74 loc) · 2.43 KB
/
config.go
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package config
import (
"time"
"github.com/gomodule/redigo/redis"
"github.com/brocaar/lora-app-server/internal/common"
"github.com/brocaar/lora-app-server/internal/handler"
"github.com/brocaar/lora-app-server/internal/handler/gcppubsub"
"github.com/brocaar/lora-app-server/internal/handler/mqtthandler"
"github.com/brocaar/lora-app-server/internal/nsclient"
)
// Config defines the configuration structure.
type Config struct {
General struct {
LogLevel int `mapstructure:"log_level"`
PasswordHashIterations int `mapstructure:"password_hash_iterations"`
}
PostgreSQL struct {
DSN string `mapstructure:"dsn"`
Automigrate bool
DB *common.DBLogger `mapstructure:"db"`
} `mapstructure:"postgresql"`
Redis struct {
URL string `mapstructure:"url"`
MaxIdle int `mapstructure:"max_idle"`
IdleTimeout time.Duration `mapstructure:"idle_timeout"`
Pool *redis.Pool
}
ApplicationServer struct {
ID string `mapstructure:"id"`
Integration struct {
Backend string
Handler handler.Handler
MQTT mqtthandler.Config `mapstructure:"mqtt"`
GCPPubSub gcppubsub.Config `mapstructure:"gcp_pub_sub"`
}
API struct {
Bind string
CACert string `mapstructure:"ca_cert"`
TLSCert string `mapstructure:"tls_cert"`
TLSKey string `mapstructure:"tls_key"`
PublicHost string `mapstructure:"public_host"`
} `mapstructure:"api"`
ExternalAPI struct {
Bind string
TLSCert string `mapstructure:"tls_cert"`
TLSKey string `mapstructure:"tls_key"`
JWTSecret string `mapstructure:"jwt_secret"`
DisableAssignExistingUsers bool `mapstructure:"disable_assign_existing_users"`
} `mapstructure:"external_api"`
Branding struct {
Header string
Footer string
Registration string
}
} `mapstructure:"application_server"`
JoinServer struct {
Bind string
CACert string `mapstructure:"ca_cert"`
TLSCert string `mapstructure:"tls_cert"`
TLSKey string `mapstructure:"tls_key"`
KEK struct {
ASKEKLabel string `mapstructure:"as_kek_label"`
Set []struct {
Label string `mapstructure:"label"`
KEK string `mapstructure:"kek"`
}
} `mapstructure:"kek"`
} `mapstructure:"join_server"`
NetworkServer struct {
Pool nsclient.Pool
} `mapstructure:"network_server"`
}
// C holds the global configuration.
var C Config