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 errors.go properties.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 {
    // project name
    Project string `json:"project" default:"hidevopsio"`
    // app name
    Name string `json:"name" default:"${APP_NAME:hiboot-app}"`
    // app description
    Description string `json:"description" default:"${app.name} is a Hiboot Application"`
    // profiles
    Profiles Profiles `json:"profiles"`
    // banner
    Banner banner
    // Version
    Version string `json:"version" default:"${APP_VERSION:v1}"`

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) (interface{}, error)
    BuildWithProfile(profile string) (interface{}, error)
    Save(p interface{}) 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

NewBuilder is the constructor of system.Builder

type Configuration Uses

type Configuration struct {
    App     App     `mapstructure:"app"`
    Server  Server  `mapstructure:"server"`
    Logging Logging `mapstructure:"logging"`

Configuration is the system configuration

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 Logging Uses

type Logging struct {
    Level string `json:"level" default:"info"`

Logging is the properties of logging

type Profiles Uses

type Profiles struct {
    // set to true or false to filter in included profiles or not
    Filter bool `json:"filter" default:"false"`
    // included profiles
    Include []string `json:"include"`
    // active profile
    Active string `json:"active" default:"${APP_PROFILES_ACTIVE:default}"`

Profiles is app profiles .include auto configuration starter should be included inside this slide .active active profile

type Server Uses

type Server struct {
    Port string `json:"port" default:"8080"`

Server is the properties of http server


typesPackage types provides all const types name

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