39 lines
952 B
Go
39 lines
952 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
type (
|
|
Config struct {
|
|
ListenAddr string
|
|
LndCertB64 string
|
|
LndAddr string
|
|
LndMacaroonHex string
|
|
LogLevel string
|
|
MatrixIdentityServer string
|
|
MatrixWellKnownAddress string
|
|
NostrAddrFee string
|
|
}
|
|
)
|
|
|
|
func GetConfig() Config {
|
|
return Config{
|
|
ListenAddr: getEnv("LISTEN_ADDR", ":8090"),
|
|
LndCertB64: getEnv("LND_CERT_B64", ""),
|
|
LndAddr: getEnv("LND_ADDR", ""),
|
|
LndMacaroonHex: getEnv("LND_MACAROON_HEX", ""),
|
|
LogLevel: getEnv("LOG_LEVEL", "INFO"),
|
|
MatrixIdentityServer: getEnv("MATRIX_IDENTITY_SERVER", ""),
|
|
MatrixWellKnownAddress: getEnv("MATRIX_WELL_KNOWN_ADDRESS", ""),
|
|
NostrAddrFee: getEnv("NOSTR_ADDR_FEE", "0"),
|
|
}
|
|
}
|
|
|
|
func getEnv(key, fallback string) string {
|
|
if value, ok := os.LookupEnv(key); ok {
|
|
return value
|
|
}
|
|
return fallback
|
|
}
|