app

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = AppVersion{
	Commit:    build.Commit,
	Version:   build.Version,
	BuildDate: build.BuildDate,
}

Functions

func Db

func Db() *gorm.DB

func InitDb added in v0.0.6

func InitDb(conf *Configuration) error

func InitLogger added in v0.0.6

func InitLogger(conf *Configuration) error

func InitSettings added in v0.0.6

func InitSettings(conf *Configuration, debug bool) error

load settings from file

func IsDevelopmentMode added in v0.0.6

func IsDevelopmentMode() bool

func IsProductionMode added in v0.0.6

func IsProductionMode() bool

func IsTestMode added in v0.0.6

func IsTestMode() bool

func ReloadConfig

func ReloadConfig()

func SaveSettings added in v0.0.6

func SaveSettings()

Types

type AppMode added in v0.0.6

type AppMode string
const (
	DevelopmentMode AppMode = "development"
	ProductionMode  AppMode = "production"
	TestMode        AppMode = "test"
)

func Environment

func Environment() AppMode

type AppVersion added in v0.0.6

type AppVersion struct {
	Commit    string `json:"commit"`
	Version   string `json:"version"`
	BuildDate string `json:"build_date"`
}

Info holds build information

type Configuration added in v0.0.6

type Configuration struct {
	Log struct {
		Level      string `koanf:"level" default:"info"`
		TimeFormat string `koanf:"time_format" default:"2006-01-02 15:04:05.000"`
		LogFile    string `koanf:"log_file"`
		AccessLog  string `koanf:"access_log"`
	} `koanf:"log" json:"log"`

	Server struct {
		ListenAddr string `koanf:"listen_addr" default:"0.0.0.0"`
		Port       int    `koanf:"port" default:"9000"`
		DataDir    string `koanf:"data_dir"`
	} `koanf:"app" json:"app"`

	Db db.Config `koanf:"db" json:"db"`
}

configuration holds any kind of configuration that comes from the outside world and is necessary for running the application.

var (
	Config *Configuration
)

func Cfg

func Cfg() *Configuration

func InitConfig added in v0.0.6

func InitConfig(path string, debug bool) (*Configuration, error)

load config from file

type SettingsConfiguration added in v0.0.6

type SettingsConfiguration struct {
	Test string `koanf:"test" default:"test"`
}

Settings holds any kind of configuration that can modify by admin web ui.

var (
	Settings *SettingsConfiguration
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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