hugo-micropub/config.go

40 lines
887 B
Go

package main
import (
"errors"
"os"
)
func GetGiteaEndpoint() (string, error) {
giteaEndpoint := os.Getenv("GITEA_ENDPOINT")
if len(giteaEndpoint) == 0 || giteaEndpoint == "" {
return "", errors.New("GITEA_ENDPOINT not specified")
}
return giteaEndpoint, nil
}
func GetGiteaToken() (string, error) {
giteaToken := os.Getenv("GITEA_TOKEN")
if len(giteaToken) == 0 || giteaToken == "" {
return "", errors.New("GITEA_TOKEN not specified")
}
return giteaToken, nil
}
func GetBlogURL() (string, error) {
blogURL := os.Getenv("BLOG_URL")
if len(blogURL) == 0 || blogURL == "" {
return "", errors.New("BLOG_URL not specified")
}
return blogURL, nil
}
func GetBunnyCDNKey() (string, error) {
bunnyCDNKey := os.Getenv("BUNNY_CDN_KEY")
if len(bunnyCDNKey) == 0 || bunnyCDNKey == "" {
return "", errors.New("BUNNY_CDN_KEY not specified")
}
return bunnyCDNKey, nil
}