well-goknown/config/config.go

27 lines
428 B
Go
Raw Normal View History

2023-02-05 01:21:10 +00:00
package config
import (
"os"
)
type (
Config struct {
MatrixIdentityServer string
MatrixWellKnownAddress string
}
)
func GetConfig() Config {
return Config{
MatrixIdentityServer: getEnv("MATRIX_IDENTITY_SERVER", ""),
MatrixWellKnownAddress: getEnv("MATRIX_WELL_KNOWN_ADDRESS", ""),
}
}
func getEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}