config

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TempDir           = os.TempDir()
	BackupDir         = filepath.Join(TempDir, "sonic-backup") + string(os.PathSeparator)
	BackupMarkdownDir = filepath.Join(TempDir, "sonic-backup-markdown") + string(os.PathSeparator)
	DataExportDir     = filepath.Join(TempDir, "sonic-data-export") + string(os.PathSeparator)
	ResourcesDir, _   = filepath.Abs("./resources")
)

Functions

func IsDev

func IsDev() bool

func LogToConsole added in v1.1.4

func LogToConsole() bool

Types

type Config

type Config struct {
	Server     Server      `mapstructure:"server"`
	Log        Log         `mapstructure:"logging"`
	PostgreSQL *PostgreSQL `mapstructure:"postgre"`
	MySQL      *MySQL      `mapstructure:"mysql"`
	SQLite3    *SQLite3    `mapstructure:"sqlite3"`
	Sonic      Sonic       `mapstructure:"sonic"`
}

func NewConfig

func NewConfig() *Config

type Levels

type Levels struct {
	App  string `mapstructure:"app"`
	Gorm string `mapstructure:"gorm"`
}

type Log

type Log struct {
	FileName string `mapstructure:"filename"`
	Levels   Levels `mapstructure:"level"`
	MaxSize  int    `mapstructure:"maxsize"`
	MaxAge   int    `mapstructure:"maxage"`
	Compress bool   `mapstructure:"compress"`
}

type LogMode added in v1.1.4

type LogMode string
const (
	Console LogMode = "console"
	File    LogMode = "file"
)

type MySQL

type MySQL struct {
	Dsn string `mapstructure:"dsn"`
}

type PostgreSQL

type PostgreSQL struct {
	Host     string `mapstructure:"host"`
	Port     string `mapstructure:"port"`
	DB       string `mapstructure:"db"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

type SQLite3

type SQLite3 struct {
	Enable bool `mapstructure:"enable"`
	File   string
}

type Server

type Server struct {
	Host string `mapstructure:"host"`
	Port string `mapstructure:"port"`
}

type Sonic

type Sonic struct {
	Mode              string  `mapstructure:"mode"`
	LogMode           LogMode `mapstructure:"log_mode"`
	WorkDir           string  `mapstructure:"work_dir"`
	UploadDir         string
	LogDir            string `mapstructure:"log_dir"`
	TemplateDir       string `mapstructure:"template_dir"`
	ThemeDir          string
	AdminResourcesDir string
	AdminURLPath      string `mapstructure:"admin_url_path"`
}

Jump to

Keyboard shortcuts

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