hiboot: hidevops.io/hiboot/pkg/system Index | Examples | Files | Directories

package system

import "hidevops.io/hiboot/pkg/system"

Package system provides system builder which response for properties dependency injection.

The auto configuration composes properties object

This example shows how to use the system build




Package Files

autoconfigure.go builder.go doc.go env.go errors.go properties.go property_builder.go yaml.go

func ReadYamlFromFile Uses

func ReadYamlFromFile(file string) (prop map[string]interface{}, err error)

ReadYamlFromFile read yaml from file directly

type App Uses

type App struct {
    // at.ConfigurationProperties annotation
    at.ConfigurationProperties `value:"app" json:"-"`
    // 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
    // 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 Uses

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 Uses

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 Uses

func NewPropertyBuilder(path string, customProperties map[string]interface{}) Builder

NewBuilder is the constructor of system.Builder

type ConfigFile Uses

type ConfigFile struct {
    // contains filtered or unexported fields

type Configuration Uses

type Configuration struct {

    App     *App
    Server  *Server
    Logging *Logging

Configuration is the system configuration

func NewConfiguration Uses

func NewConfiguration(app *App, server *Server, logging *Logging) *Configuration

type ContactInfo Uses

type ContactInfo struct {
    Name  string `json:"name,omitempty"`
    URL   string `json:"url,omitempty"`
    Email string `json:"email,omitempty"`

type Env Uses

type Env struct {
    // env name
    Name string
    // env value
    Value string

Env is the name value pair of environment variable

type ErrInvalidController Uses

type ErrInvalidController struct {
    Name string

ErrInvalidController invalid controller

func (*ErrInvalidController) Error Uses

func (e *ErrInvalidController) Error() string

type ErrNotFound Uses

type ErrNotFound struct {
    Name string

ErrNotFound resource not found error

func (*ErrNotFound) Error Uses

func (e *ErrNotFound) Error() string

type License Uses

type License struct {
    Name string `json:"name,omitempty"`
    URL  string `json:"url,omitempty"`

type Logging Uses

type Logging struct {
    // annotation
    at.ConfigurationProperties `value:"logging" json:"-"`

    Level string `json:"level,omitempty" default:"info"`

Logging is the properties of logging

type Profiles Uses

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 Uses

type Server struct {
    // annotation
    at.ConfigurationProperties `value:"server" json:"-"`
    Schemes                    []string `json:"schemes,omitempty" default:"http"`
    Host                       string   `json:"host,omitempty" default:"localhost:8080"`
    Port                       string   `json:"port,omitempty" default:"8080"`
    ContextPath                string   `json:"context_path,omitempty" default:"/"`

Server is the properties of http server


typesPackage types provides all const types name

Package system imports 19 packages (graph) and is imported by 14 packages. Updated 2019-11-04. Refresh now. Tools for package owners.