system

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

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

package main

import ()

func main() {

}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadYamlFromFile added in v0.11.2

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 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.3.0

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

NewBuilder is the constructor of system.Builder

type ConfigFile added in v1.3.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.3.0

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

type ContactInfo added in v1.3.0

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 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 License added in v1.3.0

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

Jump to

Keyboard shortcuts

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