package conf

import (
	"fmt"
	"os"
	"time"
)

const (
	envInitErrorMsg = "ENV[%s] is not set, failed to init"
)

func InitConf() error {
	AwsSqsUrl = os.Getenv("AWS_SQS_URL")
	if AwsSqsUrl == "" {
		return fmt.Errorf(envInitErrorMsg, "AWS_SQS_URL")
	}
	AwsRegion = os.Getenv("AWS_REGION")
	if AwsRegion == "" {
		return fmt.Errorf(envInitErrorMsg, "AWS_REGION")
	}
	HostName = os.Getenv("HOSTNAME")
	if HostName == "" {
		HostName = "localhost"
	}
	return nil
}

var (
	ScrapeInterval            time.Duration
	ServiceLevelProbeInterval time.Duration
	FailureMessageFile        string
	KubeConfig                string
	AwsSqsUrl                 string
	AwsRegion                 string
	HostName                  string
)
