51 lines
901 B
Go
51 lines
901 B
Go
package config
|
|
|
|
var defaultConfig = &Config{
|
|
Proto: "http",
|
|
Port: Port{
|
|
Http: 80,
|
|
Https: 443,
|
|
},
|
|
Cert: Cert{
|
|
Crt: "server.crt",
|
|
Key: "server.key",
|
|
},
|
|
Logger: Logger{
|
|
Level: "info",
|
|
File: "stdout",
|
|
},
|
|
JWT: JWT{
|
|
SecretKey: "",
|
|
RefreshTokenDuration: 2678400,
|
|
RevokeTokensOnLogout: true,
|
|
},
|
|
Stun: "stun.l.google.com:19302",
|
|
Turn: Turn{
|
|
TurnAddr: "",
|
|
TurnUser: "",
|
|
TurnCred: "",
|
|
},
|
|
Authentication: "enable",
|
|
}
|
|
|
|
func checkDefaultValue() {
|
|
if instance.JWT.SecretKey == "" {
|
|
instance.JWT.SecretKey = generateRandomSecretKey()
|
|
instance.JWT.RevokeTokensOnLogout = true
|
|
}
|
|
|
|
if instance.JWT.RefreshTokenDuration == 0 {
|
|
instance.JWT.RefreshTokenDuration = 2678400
|
|
}
|
|
|
|
if instance.Stun == "" {
|
|
instance.Stun = "stun.l.google.com:19302"
|
|
}
|
|
|
|
if instance.Authentication == "" {
|
|
instance.Authentication = "enable"
|
|
}
|
|
|
|
instance.Hardware = getHardware()
|
|
}
|