config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeZone *time.Location

Not modify this variable!!! This variable will be filled when initializing the config

Functions

This section is empty.

Types

type Config

type Config struct {
	Timezone    string `envconfig:"app_timezone" default:"UTC"` // String timezone format
	SaveLogs    bool   `envconfig:"app_save_logs" default:"false"`
	Kubernetes  KubernetesConfig
	Exec        ExecConfig
	Cron        CronConfig
	Telegram    TelegramConfig
	FileStorage FileStorageConfig
}

func Init

func Init(dotenv func()) (*Config, error)

func (*Config) CronInfoRequired

func (cfg *Config) CronInfoRequired() bool

func (*Config) FileStorageRequired

func (cfg *Config) FileStorageRequired() bool

type CronConfig

type CronConfig struct {
	Backup string `envconfig:"cron_backup" required:"true"`
	Info   string `envconfig:"cron_info"`
}

type ExecConfig

type ExecConfig struct {
	Backup string `envconfig:"exec_backup" required:"true"`
	Info   string `envconfig:"exec_info" default:"echo 1"`
}

type FileStorageConfig

type FileStorageConfig struct {
	Endpoint  string `envconfig:"fs_host"`
	Bucket    string `envconfig:"fs_bucket"`
	AccessKey string `envconfig:"fs_access_key"`
	SecretKey string `envconfig:"fs_secret_key"`
	Secure    bool   `envconfig:"fs_secure" default:"true"`
}

type KubernetesConfig

type KubernetesConfig struct {
	// Kind default Pod
	ApiVersion    string `default:"v1"`
	Host          string `envconfig:"k8s_host" required:"true"`
	Insecure      bool   `envconfig:"k8s_insecure" default:"true"`
	BearerToken   string `envconfig:"k8s_auth_token" required:"true"`
	Namespace     string `envconfig:"k8s_namespace" required:"true"`
	LabelSelector string `envconfig:"k8s_label_selector" required:"true"`
	ContainerName string `envconfig:"k8s_pod_container_name" required:"true"`
}

type TelegramConfig

type TelegramConfig struct {
	ApiEndpoint  string `envconfig:"tg_bot_api_endpoint" default:"https://api.telegram.org/bot%s/%s"`
	HttpProxy    string `envconfig:"tg_bot_http_proxy"`
	BotToken     string `envconfig:"tg_bot_token"`
	Notification TelegramNotificationConfig
}

func (*TelegramConfig) NotificationsEnabled

func (tgcfg *TelegramConfig) NotificationsEnabled() bool

Func for check telegram notifications enabled

type TelegramNotificationBackupConfig

type TelegramNotificationBackupConfig struct {
	Enabled bool    `envconfig:"tg_backup_notification_enabled" default:"false"`
	ChatIds []int64 `envconfig:"tg_backup_notification_chats" split_words:"true"`
}

type TelegramNotificationConfig

type TelegramNotificationConfig struct {
	Backup TelegramNotificationBackupConfig
	Info   TelegramNotificationInfoConfig
}

type TelegramNotificationInfoConfig

type TelegramNotificationInfoConfig struct {
	Enabled bool    `envconfig:"tg_info_notification_enabled" default:"false"`
	ChatIds []int64 `envconfig:"tg_info_notification_chats" split_words:"true"`
}

Jump to

Keyboard shortcuts

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