config

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_PORT = "5001"
)

Variables

View Source
var ConfigStore atomic.Value

Functions

func InitConfig

func InitConfig(configFile string) error

func MockConfig

func MockConfig(enableAutoGeneration bool, url string, authorizationToken string)

MockConfig sets a mock configuration for testing purposes.

func SetGrafanaExporterEnvs

func SetGrafanaExporterEnvs() error

Types

type AccountNumberGenerationConfig

type AccountNumberGenerationConfig struct {
	EnableAutoGeneration bool `json:"enable_auto_generation"`
	HttpService          struct {
		Url     string `json:"url"`
		Timeout int    `json:"timeout"`
		Headers struct {
			Authorization string `json:"Authorization"`
		} `json:"headers"`
	} `json:"http_service"`
}

type Configuration

type Configuration struct {
	ProjectName             string                        `json:"project_name" envconfig:"BLNK_PROJECT_NAME"`
	BackupDir               string                        `json:"backup_dir" envconfig:"BLNK_BACKUP_DIR"`
	AwsAccessKeyId          string                        `json:"aws_access_key_id"`
	AwsSecretAccessKey      string                        `json:"aws_secret_access_key"`
	S3BucketName            string                        `json:"s3_bucket_name"`
	S3Region                string                        `json:"s3_region"`
	Server                  ServerConfig                  `json:"server"`
	DataSource              DataSourceConfig              `json:"data_source"`
	Redis                   RedisConfig                   `json:"redis"`
	AccountNumberGeneration AccountNumberGenerationConfig `json:"account_number_generation"`
	Notification            Notification                  `json:"notification"`
	OtelGrafanaCloud        OtelGrafanaCloud              `json:"otel_grafana_cloud"`
}

func Fetch

func Fetch() (*Configuration, error)

type DataSourceConfig

type DataSourceConfig struct {
	Dns string `json:"dns" envconfig:"BLNK_DATA_SOURCE_DNS"`
}

type Notification

type Notification struct {
	Slack struct {
		WebhookUrl string `json:"webhook_url"`
	} `json:"slack"`
	Webhook struct {
		Url     string            `json:"url"`
		Headers map[string]string `json:"headers"`
	} `json:"webhook"`
}

type OtelGrafanaCloud

type OtelGrafanaCloud struct {
	OtelExporterOtlpProtocol string `json:"OTEL_EXPORTER_OTLP_PROTOCOL"`
	OtelExporterOtlpEndpoint string `json:"OTEL_EXPORTER_OTLP_ENDPOINT"`
	OtelExporterOtlpHeaders  string `json:"OTEL_EXPORTER_OTLP_HEADERS"`
}

type RedisConfig

type RedisConfig struct {
	Dns string `json:"dns" envconfig:"BLNK_REDIS_DNS"`
}

type ServerConfig

type ServerConfig struct {
	SSL       bool   `json:"ssl" envconfig:"BLNK_SERVER_SSL"`
	Secure    bool   `json:"secure" envconfig:"BLNK_SERVER_SECURE"`
	SecretKey string `json:"secret_key" envconfig:"BLNK_SERVER_SECRET_KEY"`
	Domain    string `json:"domain" envconfig:"BLNK_SERVER_SSL_DOMAIN"`
	Email     string `json:"ssl_email" envconfig:"BLNK_SERVER_SSL_EMAIL"`
	Port      string `json:"port" envconfig:"BLNK_SERVER_PORT"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL