config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config implements the config interface for the viper config backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Databases   []Database    `mapstructure:"databases"`
	Zitadel     ZitadelConfig `mapstructure:"zitadel"`
	Env         string        `mapstructure:"env"`
	TimeZone    string        `mapstructure:"timezone"`
	UploadsPath string        `mapstructure:"uploads_path"`
}

Config represents the overall configuration structure

func ConfigFactory

func ConfigFactory(t string, path string, logger logger.ILogger) Config

ConfigFactory creates a Config object based on the provided type and path

type Database

type Database struct {
	Host     string            `mapstructure:"host"`
	Port     int               `mapstructure:"port"`
	Username string            `mapstructure:"username"`
	Password string            `mapstructure:"password"`
	Type     string            `mapstructure:"type"`
	Name     string            `mapstructure:"name"`
	Database string            `mapstructure:"database"`
	Tables   map[string]string `mapstructure:"tables"`
}

Database holds the configuration for database connections

type IConfig

type IConfig interface {
	ReadFile(path string)
	BindEnv() error
	GetConfig() (config Config)
}

IConfig interface defines methods for config management

type ViperConfig

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

ViperConfig is the viper config backend.

func NewViperConfig

func NewViperConfig(logger logger.ILogger) *ViperConfig

NewViperConfig creates a new viper config backend.

func (*ViperConfig) BindAllEnv

func (vc *ViperConfig) BindAllEnv() (err error)

func (*ViperConfig) GetConfig

func (vc *ViperConfig) GetConfig() (Config, error)

GetConfig reads the config file and unmarshals it into the config struct.

func (*ViperConfig) ReadFile

func (vc *ViperConfig) ReadFile(path string)

ReadFile reads the config file from the path.

type ZitadelConfig

type ZitadelConfig struct {
	Domain  string `mapstructure:"domain"`
	Port    int    `mapstructure:"port"`
	KeyPath string `mapstructure:"key_path"`
	Enabled bool   `mapstructure:"enabled"`
}

ZitadelConfig holds the configuration for Zitadel

Jump to

Keyboard shortcuts

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