2fas-server/internal/api/support/domain/support_config.go

30 lines
1.1 KiB
Go
Raw Normal View History

2022-12-31 10:22:38 +01:00
package domain
import (
"github.com/spf13/viper"
"time"
)
type DebugLogsConfig struct {
AwsAccessKeyId string
AwsSecretAccessKey string
AwsRegion string `mapstructure:"aws_region" json:"aws_region"`
AwsProfile string `mapstructure:"aws_profile" json:"aws_profile"`
DebugLogsDirectory string `mapstructure:"directory" json:"debug_logs_directory"`
ExpireAt time.Duration `mapstructure:"expire_at" json:"expire_at"`
}
func LoadDebugLogsConfig() DebugLogsConfig {
viper.BindEnv("mobile.debug.aws_access_key_id", "MOBILE_DEBUG_AWS_ACCESS_KEY_ID")
viper.BindEnv("mobile.debug.aws_secret_access_key", "MOBILE_DEBUG_AWS_SECRET_ACCESS_KEY")
return DebugLogsConfig{
AwsRegion: viper.GetString("mobile.debug.aws_region"),
AwsProfile: viper.GetString("mobile.debug.aws_profile"),
AwsAccessKeyId: viper.GetString("mobile.debug.aws_access_key_id"),
AwsSecretAccessKey: viper.GetString("mobile.debug.aws_secret_access_key"),
DebugLogsDirectory: viper.GetString("mobile.debug.directory"),
ExpireAt: time.Hour * 24 * 7,
}
}