config

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configuration management for GitLab backup application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GitlabGroupID   int         `env:"GITLABGROUPID"   env-default:"0"                  yaml:"gitlabGroupID"`
	GitlabProjectID int         `env:"GITLABPROJECTID" env-default:"0"                  yaml:"gitlabProjectID"`
	GitlabToken     string      `env:"GITLAB_TOKEN"    env-required:"true"              yaml:"gitlabToken"`
	GitlabURI       string      `env:"GITLAB_URI"      env-default:"https://gitlab.com" yaml:"gitlabURI"`
	LocalPath       string      `env:"LOCALPATH"       env-default:""                   yaml:"localpath"`
	TmpDir          string      `env:"TMPDIR"          env-default:"/tmp"               yaml:"tmpdir"`
	Hooks           hooks.Hooks `yaml:"hooks"`
	S3cfg           S3Config    `yaml:"s3cfg"`
	NoLogTime       bool        `env:"NOLOGTIME"       env-default:"false"              yaml:"noLogTime"`
}

Config holds the application configuration.

func NewConfigFromEnv

func NewConfigFromEnv() (*Config, error)

NewConfigFromEnv returns a new Config struct from the environment variables.

func NewConfigFromFile

func NewConfigFromFile(filePath string) (*Config, error)

NewConfigFromFile returns a new Config struct from the given file.

func (*Config) IsConfigValid

func (c *Config) IsConfigValid() bool

IsConfigValid returns true if the config is valid.

func (*Config) IsLocalConfigValid

func (c *Config) IsLocalConfigValid() bool

IsLocalConfigValid returns true if the local config is valid.

func (*Config) IsS3ConfigValid

func (c *Config) IsS3ConfigValid() bool

IsS3ConfigValid returns true if the S3 config is valid.

func (*Config) String

func (c *Config) String() string

func (*Config) Usage

func (c *Config) Usage()

Usage prints the usage of the config.

type S3Config

type S3Config struct {
	Endpoint   string `env:"S3ENDPOINT"            env-default:""   yaml:"endpoint"`
	BucketName string `env:"S3BUCKETNAME"          env-default:""   yaml:"bucketName"`
	BucketPath string `env:"S3BUCKETPATH"          env-default:""   yaml:"bucketPath"`
	Region     string `env:"S3REGION"              env-default:""   yaml:"region"`
	AccessKey  string `env:"AWS_ACCESS_KEY_ID"     yaml:"accessKey"`
	SecretKey  string `env:"AWS_SECRET_ACCESS_KEY" yaml:"secretKey"`
}

S3Config holds the configuration for S3 storage backend.

Jump to

Keyboard shortcuts

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