config

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DEV represents development environment
	DEV = "develop"
	// PRD represents production environment
	PRD = "production"
	// DOC represents docker container
	DOC = "docker"
)
View Source
const (
	// AppConfigPath is the path of application.yml.
	AppConfigPath = "resources/config/application.%s.yml"
	// MessagesConfigPath is the path of messages.properties.
	MessagesConfigPath = "resources/config/messages.properties"
	// LoggerConfigPath is the path of zaplogger.yml.
	LoggerConfigPath = "resources/config/zaplogger.%s.yml"
)
View Source
const (
	// API represents the group of API.
	API = "/api"
	// APIBooks represents the group of book management API.
	APIBooks = API + "/books"
	// APIBooksID represents the API to get book data using id.
	APIBooksID = APIBooks + "/:id"
	// APICategories represents the group of category management API.
	APICategories = API + "/categories"
	// APIFormats represents the group of format management API.
	APIFormats = API + "/formats"
)
View Source
const (
	// APIAccount represents the group of auth management API.
	APIAccount = API + "/auth"
	// APIAccountLoginStatus represents the API to get the status of logged in account.
	APIAccountLoginStatus = APIAccount + "/loginStatus"
	// APIAccountLoginAccount represents the API to get the logged in account.
	APIAccountLoginAccount = APIAccount + "/loginAccount"
	// APIAccountLogin represents the API to login by session authentication.
	APIAccountLogin = APIAccount + "/login"
	// APIAccountLogout represents the API to logout.
	APIAccountLogout = APIAccount + "/logout"
)
View Source
const (
	// APIHealth represents the API to get the status of this application.
	APIHealth = API + "/health"
)
View Source
const ErrExitStatus int = 2

ErrExitStatus represents the error status in this application.

View Source
const PasswordHashCost int = 10

PasswordHashCost is hash cost for a password.

Variables

This section is empty.

Functions

func LoadMessagesConfig added in v1.5.6

func LoadMessagesConfig(propsFile embed.FS) map[string]string

LoadMessagesConfig loads the messages.properties.

Types

type Config

type Config struct {
	Database struct {
		Dialect   string `default:"sqlite3"`
		Host      string `default:"book.db"`
		Port      string
		Dbname    string
		Username  string
		Password  string
		Migration bool `default:"false"`
	}
	Redis struct {
		Enabled            bool `default:"false"`
		ConnectionPoolSize int  `yaml:"connection_pool_size" default:"10"`
		Host               string
		Port               string
	}
	Extension struct {
		MasterGenerator bool `yaml:"master_generator" default:"false"`
		CorsEnabled     bool `yaml:"cors_enabled" default:"false"`
		SecurityEnabled bool `yaml:"security_enabled" default:"false"`
	}
	Log struct {
		RequestLogFormat string `yaml:"request_log_format" default:"${remote_ip} ${account_name} ${uri} ${method} ${status}"`
	}
	StaticContents struct {
		Enabled bool `default:"false"`
	}
	Swagger struct {
		Enabled bool `default:"false"`
		Path    string
	}
	Security struct {
		AuthPath    []string `yaml:"auth_path"`
		ExculdePath []string `yaml:"exclude_path"`
		UserPath    []string `yaml:"user_path"`
		AdminPath   []string `yaml:"admin_path"`
	}
}

Config represents the composition of yml settings.

func LoadAppConfig added in v1.5.6

func LoadAppConfig(yamlFile embed.FS) (*Config, string)

LoadAppConfig reads the settings written to the yml file

Jump to

Keyboard shortcuts

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