config

package
v1.0.1-0...-b7751fa Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintDefaultConfig

func PrintDefaultConfig()

PrintDefaultConfig - print default config to stdout

func ValidateConfig

func ValidateConfig(cfg *Config) error

Types

type APIConfig

type APIConfig struct {
	ListenAddr    string `yaml:"listen" envconfig:"API_LISTEN"`
	EnableMetrics bool   `yaml:"enable_metrics" envconfig:"API_ENABLE_METRICS"`
	EnablePprof   bool   `yaml:"enable_pprof" envconfig:"API_ENABLE_PPROF"`
	Username      string `yaml:"username" envconfig:"API_USERNAME"`
	Password      string `yaml:"password" envconfig:"API_PASSWORD"`
}

type AzureBlobConfig

type AzureBlobConfig struct {
	EndpointSuffix        string `yaml:"endpoint_suffix" envconfig:"AZBLOB_ENDPOINT_SUFFIX"`
	AccountName           string `yaml:"account_name" envconfig:"AZBLOB_ACCOUNT_NAME"`
	AccountKey            string `yaml:"account_key" envconfig:"AZBLOB_ACCOUNT_KEY"`
	SharedAccessSignature string `yaml:"sas" envconfig:"AZBLOB_SAS"`
	Container             string `yaml:"container" envconfig:"AZBLOB_CONTAINER"`
	Path                  string `yaml:"path" envconfig:"AZBLOB_PATH"`
	CompressionLevel      int    `yaml:"compression_level" envconfig:"AZBLOB_COMPRESSION_LEVEL"`
	CompressionFormat     string `yaml:"compression_format" envconfig:"AZBLOB_COMPRESSION_FORMAT"`
	SSEKey                string `yaml:"sse_key" envconfig:"AZBLOB_SSE_KEY"`
}

AzureBlobConfig - Azure Blob settings section

type COSConfig

type COSConfig struct {
	RowURL            string `yaml:"url" envconfig:"COS_URL"`
	Timeout           string `yaml:"timeout" envconfig:"COS_TIMEOUT"`
	SecretID          string `yaml:"secret_id" envconfig:"COS_SECRET_ID"`
	SecretKey         string `yaml:"secret_key" envconfig:"COS_SECRET_KEY"`
	Path              string `yaml:"path" envconfig:"COS_PATH"`
	CompressionFormat string `yaml:"compression_format" envconfig:"COS_COMPRESSION_FORMAT"`
	CompressionLevel  int    `yaml:"compression_level" envconfig:"COS_COMPRESSION_LEVEL"`
	Debug             bool   `yaml:"debug" envconfig:"COS_DEBUG"`
}

COSConfig - cos settings section

type ClickHouseConfig

type ClickHouseConfig struct {
	Username     string   `yaml:"username" envconfig:"CLICKHOUSE_USERNAME"`
	Password     string   `yaml:"password" envconfig:"CLICKHOUSE_PASSWORD"`
	Host         string   `yaml:"host" envconfig:"CLICKHOUSE_HOST"`
	Port         uint     `yaml:"port" envconfig:"CLICKHOUSE_PORT"`
	DataPath     string   `yaml:"data_path" envconfig:"CLICKHOUSE_DATA_PATH"`
	SkipTables   []string `yaml:"skip_tables" envconfig:"CLICKHOUSE_SKIP_TABLES"`
	Timeout      string   `yaml:"timeout" envconfig:"CLICKHOUSE_TIMEOUT"`
	FreezeByPart bool     `yaml:"freeze_by_part" envconfig:"CLICKHOUSE_FREEZE_BY_PART"`
}

ClickHouseConfig - clickhouse settings section

type Config

type Config struct {
	General    GeneralConfig    `yaml:"general"`
	ClickHouse ClickHouseConfig `yaml:"clickhouse"`
	S3         S3Config         `yaml:"s3"`
	GCS        GCSConfig        `yaml:"gcs"`
	COS        COSConfig        `yaml:"cos"`
	API        APIConfig        `yaml:"api"`
	FTP        FTPConfig        `yaml:"ftp"`
	AzureBlob  AzureBlobConfig  `yaml:"azblob"`
}

Config - config file format

func DefaultConfig

func DefaultConfig() *Config

func LoadConfig

func LoadConfig(configLocation string) (*Config, error)

LoadConfig - load config from file

type FTPConfig

type FTPConfig struct {
	Address           string `yaml:"address" envconfig:"FTP_ADDRESS"`
	Timeout           string `yaml:"timeout" envconfig:"FTP_TIMEOUT"`
	Username          string `yaml:"username" envconfig:"FTP_USERNAME"`
	Password          string `yaml:"password" envconfig:"FTP_PASSWORD"`
	TLS               bool   `yaml:"tls" envconfig:"FTP_TLS"`
	Path              string `yaml:"path" envconfig:"FTP_PATH"`
	CompressionFormat string `yaml:"compression_format" envconfig:"FTP_COMPRESSION_FORMAT"`
	CompressionLevel  int    `yaml:"compression_level" envconfig:"FTP_COMPRESSION_LEVEL"`
	Debug             bool   `yaml:"debug" envconfig:"FTP_DEBUG"`
}

FTPConfig - ftp settings section

type GCSConfig

type GCSConfig struct {
	CredentialsFile   string `yaml:"credentials_file" envconfig:"GCS_CREDENTIALS_FILE"`
	CredentialsJSON   string `yaml:"credentials_json" envconfig:"GCS_CREDENTIALS_JSON"`
	Bucket            string `yaml:"bucket" envconfig:"GCS_BUCKET"`
	Path              string `yaml:"path" envconfig:"GCS_PATH"`
	CompressionLevel  int    `yaml:"compression_level" envconfig:"GCS_COMPRESSION_LEVEL"`
	CompressionFormat string `yaml:"compression_format" envconfig:"GCS_COMPRESSION_FORMAT"`
}

GCSConfig - GCS settings section

type GeneralConfig

type GeneralConfig struct {
	RemoteStorage       string `yaml:"remote_storage" envconfig:"REMOTE_STORAGE"`
	DisableProgressBar  bool   `yaml:"disable_progress_bar" envconfig:"DISABLE_PROGRESS_BAR"`
	BackupsToKeepLocal  int    `yaml:"backups_to_keep_local" envconfig:"BACKUPS_TO_KEEP_LOCAL"`
	BackupsToKeepRemote int    `yaml:"backups_to_keep_remote" envconfig:"BACKUPS_TO_KEEP_REMOTE"`
}

GeneralConfig - general setting section

type S3Config

type S3Config struct {
	AccessKey               string `yaml:"access_key" envconfig:"S3_ACCESS_KEY"`
	SecretKey               string `yaml:"secret_key" envconfig:"S3_SECRET_KEY"`
	Bucket                  string `yaml:"bucket" envconfig:"S3_BUCKET"`
	Endpoint                string `yaml:"endpoint" envconfig:"S3_ENDPOINT"`
	Region                  string `yaml:"region" envconfig:"S3_REGION"`
	ACL                     string `yaml:"acl" envconfig:"S3_ACL"`
	ForcePathStyle          bool   `yaml:"force_path_style" envconfig:"S3_FORCE_PATH_STYLE"`
	Path                    string `yaml:"path" envconfig:"S3_PATH"`
	DisableSSL              bool   `yaml:"disable_ssl" envconfig:"S3_DISABLE_SSL"`
	PartSize                int64  `yaml:"part_size" envconfig:"S3_PART_SIZE"`
	CompressionLevel        int    `yaml:"compression_level" envconfig:"S3_COMPRESSION_LEVEL"`
	CompressionFormat       string `yaml:"compression_format" envconfig:"S3_COMPRESSION_FORMAT"`
	SSE                     string `yaml:"sse" envconfig:"S3_SSE"`
	DisableCertVerification bool   `yaml:"disable_cert_verification" envconfig:"S3_DISABLE_CERT_VERIFICATION"`
	Debug                   bool   `yaml:"debug" envconfig:"S3_DEBUG"`
	StorageClass            string `yaml:"storage_class" envconfig:"S3_STORAGE_CLASS"`
}

S3Config - s3 settings section

Jump to

Keyboard shortcuts

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