This repository has been archived on 2022-05-25. You can view files and clone it, but cannot push or open issues or pull requests.
elon-eats-my-tweets/config/config.go

23 lines
480 B
Go

package config
import "os"
type TwitterCredentials struct {
ClientID, ClientSecret, CallbackURL string
}
type Config struct {
PublicPath string
Twitter TwitterCredentials
}
func NewFromEnv() Config {
return Config{
PublicPath: os.Getenv("ELON_PUBLIC_PATH"),
Twitter: TwitterCredentials{
ClientID: os.Getenv("ELON_TWITTER_CLIENT_ID"),
ClientSecret: os.Getenv("ELON_TWITTER_CLIENT_SECRET"),
CallbackURL: os.Getenv("ELON_TWITTER_CALLBACK_URL"),
},
}
}