All checks were successful
🚀 Publish Release Package / publish (push) Successful in 22s
37 lines
804 B
Go
Executable File
37 lines
804 B
Go
Executable File
package client
|
|
|
|
import (
|
|
"gitea.siteworxpro.com/golang-packages/utilities/Env"
|
|
"log"
|
|
)
|
|
|
|
const (
|
|
apiEndpoint Env.EnvironmentVariable = "API_ENDPOINT"
|
|
clientId Env.EnvironmentVariable = "CLIENT_ID"
|
|
clientSecret Env.EnvironmentVariable = "CLIENT_SECRET"
|
|
)
|
|
|
|
type Configuration struct {
|
|
Endpoint string
|
|
ClientId string
|
|
ClientSecret string
|
|
}
|
|
|
|
func ConfigFromEnv() *Configuration {
|
|
config := Configuration{
|
|
Endpoint: apiEndpoint.GetEnvString("https://email.siteworxpro.com"),
|
|
ClientId: clientId.GetEnvString(""),
|
|
ClientSecret: clientSecret.GetEnvString(""),
|
|
}
|
|
|
|
if config.ClientId == "" {
|
|
log.Fatal("Client ID not provided in ENV. use CLIENT_ID")
|
|
}
|
|
|
|
if config.ClientSecret == "" {
|
|
log.Fatal("Client Secret not provided in ENV. use ClientSecret")
|
|
}
|
|
|
|
return &config
|
|
}
|