Documentation
¶
Overview ¶
Package system provides system builder which response for properties dependency injection.
The auto configuration composes properties object
Index ¶
Examples ¶
Constants ¶
const ( Config = "app.config" ConfigDir = "app.config.dir" )
Variables ¶
This section is empty.
Functions ¶
func ReadYamlFromFile ¶ added in v0.11.2
ReadYamlFromFile read yaml from file directly
Types ¶
type App ¶
type App struct {
// at.ConfigurationProperties annotation
at.ConfigurationProperties `value:"app" json:"-"`
at.AutoWired
// project name
Title string `json:"title,omitempty" default:"HiBoot Demo Application"`
// project name
Project string `json:"project,omitempty" default:"hidevopsio"`
// app name
Name string `json:"name,omitempty" default:"hiboot-app"`
// app description
Description string `json:"description,omitempty" default:"${app.name} is a Hiboot Application"`
// profiles
Profiles Profiles `json:"profiles"`
// banner
Banner banner `json:"banner"`
// Version
Version string `json:"version,omitempty" default:"${APP_VERSION:v1}"`
// TermsOfService
TermsOfService string `json:"termsOfService,omitempty"`
Contact *ContactInfo `json:"contact,omitempty"`
License *License `json:"license,omitempty"`
}
App is the properties of the application, it hold the base info of the application
type Builder ¶
type Builder interface {
Init() error
Build(profiles ...string) (p interface{}, err error)
BuildWithProfile(profile string) (interface{}, error)
Load(properties interface{}, opts ...func(*mapstructure.DecoderConfig)) (err error)
Save(p interface{}) (err error)
Replace(source string) (retVal interface{})
GetProperty(name string) (retVal interface{})
SetProperty(name string, val interface{}) Builder
SetDefaultProperty(name string, val interface{}) Builder
SetConfiguration(in interface{})
}
Builder is the config file (yaml, json) builder
func NewBuilder ¶ added in v0.9.8
func NewBuilder(configuration interface{}, path, name, fileType string, customProperties map[string]interface{}) Builder
Deprecated use NewPropertyBuilder instead NewBuilder is the constructor of system.Builder
func NewPropertyBuilder ¶ added in v1.5.0
NewBuilder is the constructor of system.Builder
type ConfigFile ¶ added in v1.5.0
type ConfigFile struct {
// contains filtered or unexported fields
}
type Configuration ¶
type Configuration struct {
at.AutoConfiguration
App *App
Server *Server
Logging *Logging
}
Configuration is the system configuration
func NewConfiguration ¶ added in v1.5.0
func NewConfiguration() *Configuration
type ContactInfo ¶ added in v1.5.0
type ErrInvalidController ¶ added in v0.7.1
type ErrInvalidController struct {
Name string
}
ErrInvalidController invalid controller
func (*ErrInvalidController) Error ¶ added in v0.7.1
func (e *ErrInvalidController) Error() string
type ErrNotFound ¶ added in v0.7.1
type ErrNotFound struct {
Name string
}
ErrNotFound resource not found error
func (*ErrNotFound) Error ¶ added in v0.7.1
func (e *ErrNotFound) Error() string
type Logging ¶
type Logging struct {
// annotation
at.ConfigurationProperties `value:"logging" json:"-"`
at.AutoWired
Level string `json:"level,omitempty" default:"info"`
TimeFormat string `json:"timeFormat" default:"[2006-01-02 15:04:05.000]"`
}
Logging is the properties of logging
type Profiles ¶
type Profiles struct {
// included profiles
Include []string `json:"include,omitempty"`
// active profile
Active string `json:"active,omitempty" default:"default"`
}
Profiles is app profiles .include auto configuration starter should be included inside this slide .active active profile
type Server ¶
type Server struct {
// annotation
at.ConfigurationProperties `value:"server" json:"-"`
at.AutoWired
Schemes []string `json:"schemes,omitempty" default:"http"`
Host string `json:"host,omitempty" default:"localhost"`
Port string `json:"port,omitempty" default:"8080"`
ContextPath string `json:"context_path,omitempty" default:"/"`
TlsCert string `json:"tls_cert,omitempty" `
TlsKey string `json:"tls_key,omitempty" `
}
Server is the properties of http server