setup

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabaseConfigName

func GetDatabaseConfigName() ([]string, error)

func GetStorageConfigName

func GetStorageConfigName() ([]string, error)

func InteractiveRegisterDatabase

func InteractiveRegisterDatabase()

func InteractiveRegisterStorage

func InteractiveRegisterStorage()

func RegisterDatabase

func RegisterDatabase(databaseType DatabaseType, name string, cronExpr string, storages []string, requirements interface{}) error

func RegisterLocalFilesDatabase

func RegisterLocalFilesDatabase(path string) (*localfiles.LocalFilesRequirements, error)

func RegisterLocalStorage

func RegisterLocalStorage(path string) (*localstorage.LocalStorageRequirements, error)

func RegisterPostgresqlDatabase

func RegisterPostgresqlDatabase(host string, user string, name string, password string) (*postgresql.PostgresqlRequirements, error)

func RegisterS3Storage

func RegisterS3Storage(bucket_name string, access_key_id string, access_key_secret string, endpoint string, region string) (*s3.S3Requirements, error)

func RegisterSqlite3Database

func RegisterSqlite3Database(path string) (*sqlite3.Sqlite3Requirements, error)

func RegisterStorage

func RegisterStorage(storageType StorageType, name string, retention int, cipher_key string, compression bool, storage interface{}) error

func SetMasterPassword

func SetMasterPassword(config *Config, password string) error

SetMasterPassword sets the master password for config export

func UpdateConfig

func UpdateConfig(config Config) error

UpdateConfig updates the configuration file with the provided config

func ValidateMasterPassword

func ValidateMasterPassword(config *Config, password string) error

ValidateMasterPassword checks if the provided password matches the stored hash

func WriteConfigUnciphered

func WriteConfigUnciphered(path string, config Config) error

WriteConfigUnciphered writes the config to the specified path without encryption

Types

type Config

type Config struct {
	Version    string     `yaml:"version"`
	MasterHash string     `yaml:"master_hash,omitempty"`
	Databases  []Database `yaml:"databases,omitempty"`
	Storages   []Storage  `yaml:"storages,omitempty"`
}

func ReadConfigUnciphered

func ReadConfigUnciphered() (Config, error)

ReadConfigUnciphered reads the config file and returns an unciphered copy

type Database

type Database struct {
	Type       DatabaseType                      `yaml:"database_type"`
	Name       string                            `yaml:"name"`
	Postgresql postgresql.PostgresqlRequirements `yaml:"postgresql,omitempty"`
	Sqlite3    sqlite3.Sqlite3Requirements       `yaml:"sqlite3,omitempty"`
	LocalFiles localfiles.LocalFilesRequirements `yaml:"local_files,omitempty"`
	Storages   []string                          `yaml:"storages"`
	Cron       string                            `yaml:"cron"`
}

func ReadDatabaseConfig

func ReadDatabaseConfig(name string) (Database, error)

type DatabaseType

type DatabaseType int64
const (
	Postgresql DatabaseType = 1
	Sqlite3    DatabaseType = 2
	LocalFiles DatabaseType = 3
)

type SecureManager

type SecureManager struct {
	// contains filtered or unexported fields
}

func NewSecureManager

func NewSecureManager(noEncryption bool) (*SecureManager, error)

NewSecureManager creates a new secure manager instance

func (*SecureManager) DecryptConfig

func (sm *SecureManager) DecryptConfig(config *Config) error

DecryptConfig decrypts sensitive fields in the configuration

func (*SecureManager) SecureConfig

func (sm *SecureManager) SecureConfig(config *Config) error

SecureConfig encrypts sensitive fields in the configuration

type Storage

type Storage struct {
	Type                   StorageType                           `yaml:"storage_type"`
	Name                   string                                `yaml:"name"`
	CipherKey              string                                `yaml:"cypher_key"`
	RetentionDays          int                                   `yaml:"retention_days" default:"21"`
	ExecuteRetentionPolicy bool                                  `yaml:"execute_retention_policy" default:"true"`
	Compression            bool                                  `yaml:"compression" default:"true"`
	LocalStorage           localstorage.LocalStorageRequirements `yaml:"local_storage,omitempty"` // Make local_storage optional
	S3                     s3.S3Requirements                     `yaml:"s3,omitempty"`            // Make s3 optional
}

func ReadStorageConfig

func ReadStorageConfig(name string) (Storage, error)

type StorageType

type StorageType int64
const (
	LocalStorage StorageType = 1
	S3           StorageType = 2
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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