config

package
v0.0.0-...-a39d757 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootDirFlagFile if file that we place at the root of our project to
	// hold some important data, but also to flag us that it is the root
	RootDirFlagFile = ".uno"
)

Variables

This section is empty.

Functions

func GetBasePath

func GetBasePath() (base string, err error)

GetBasePath returns applications base path

Types

type AppConfig

type AppConfig struct {
	BasePath string
	Key      string
	Verbose  bool
}

AppConfig

func NewAppConfig

func NewAppConfig() (*AppConfig, error)

NewAppConfig returns new instance of app configuration struct

type Config

type Config struct {
	DB     *DBConfig
	Server *ServerConfig
	App    *AppConfig
}

Config struct holds field names for most common data (DB, etc) but also has capacity to hold dynamic config registration Config must be serializable/unserializable, so dont' put any structs with methods here

func NewConfig

func NewConfig() (*Config, error)

NewConfig returns new instance of global configuration struct

func ReplaceTplVars

func ReplaceTplVars(cfg *Config) (*Config, error)

ReplaceTplVars replaces tpl vars like {App.BasePath} with actuall values

type DBConfig

type DBConfig struct {
	Name     string
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
	DSN      string
	Migrate  *MigrateConfig
}

DBConfig

func NewDBConfig

func NewDBConfig() *DBConfig

NewConfig returns new Config instance for the current environment

func NewMySqlDBConfig

func NewMySqlDBConfig() *DBConfig

NewConfig returns new Config instance for the current environment

func NewSqliteDBConfig

func NewSqliteDBConfig() *DBConfig

NewConfig returns new Config instance for the current environment

func (*DBConfig) ToString

func (c *DBConfig) ToString() string

ToString implements config.Node interface

type MigrateConfig

type MigrateConfig struct {
	Dir   string
	Table string
}

MigrateConfig

func NewMigrateConfig

func NewMigrateConfig() *MigrateConfig

NewMigrateConfig returns migration config based on env settings

type ServerConfig

type ServerConfig struct {
	Address string
}

ServerConfig

func NewServerConfig

func NewServerConfig() *ServerConfig

NewServerConfig creates new instance of ServerConfig with default values

Jump to

Keyboard shortcuts

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