Documentation

Overview

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

    The auto configuration composes properties object

    Example

      This example shows how to use the system build

      Output:
      
      

      Index

      Examples

      Constants

      This section is empty.

      Variables

      This section is empty.

      Functions

      func ReadYamlFromFile

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

        ReadYamlFromFile read yaml from file directly

        Types

        type App

        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

          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

            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

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

                NewBuilder is the constructor of system.Builder

                type ConfigFile

                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

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

                  type ContactInfo

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

                  type Env

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

                    Env is the name value pair of environment variable

                    type ErrInvalidController

                    type ErrInvalidController struct {
                    	Name string
                    }

                      ErrInvalidController invalid controller

                      func (*ErrInvalidController) Error

                      func (e *ErrInvalidController) Error() string

                      type ErrNotFound

                      type ErrNotFound struct {
                      	Name string
                      }

                        ErrNotFound resource not found error

                        func (*ErrNotFound) Error

                        func (e *ErrNotFound) Error() string

                        type License

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

                        type Logging

                        type Logging struct {
                        	// annotation
                        	at.ConfigurationProperties `value:"logging" json:"-"`
                        
                        	Level string `json:"level,omitempty" default:"info"`
                        }

                          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:"-"`
                            	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

                              Directories

                              Path Synopsis
                              Package types provides all const types name
                              Package types provides all const types name