27 lines
428 B
Go
27 lines
428 B
Go
|
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
|
||
|
}
|