sentinel/env/env.go

28 lines
667 B
Go
Raw Permalink Normal View History

2021-03-04 08:04:05 +01:00
package env
import (
"github.com/lbryio/lbry.go/v2/extras/errors"
e "github.com/caarlos0/env"
)
// Config holds the environment configuration used by lighthouse.
type Config struct {
2021-03-08 05:54:50 +01:00
CoinMineAPIKey string `env:"COINMINE_API_KEY"`
MiningDutchAPIKey string `env:"MININGDUTCH_API_KEY"`
LbrycrdURL string `env:"LBRYCRD_CONNECT" envDefault:""`
SlackHookURL string `env:"SLACKHOOKURL"`
SlackChannel string `env:"SLACKCHANNEL"`
2021-03-04 08:04:05 +01:00
}
// NewWithEnvVars creates an Config from environment variables
func NewWithEnvVars() (*Config, error) {
cfg := &Config{}
err := e.Parse(cfg)
if err != nil {
return nil, errors.Err(err)
}
return cfg, nil
}