Version: v0.0.0-...-c891ed9 Latest Latest

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

Go to latest
Published: Oct 5, 2019 License: Apache-2.0 Imports: 14 Imported by: 0




This section is empty.


This section is empty.


func ConfigNeuron

func ConfigNeuron(path ...string) error

ConfigNeuron is responsible for configuring neuron, this has to be called if api has to be exposed.

func JsonDecode

func JsonDecode(data []byte, i interface{}) error

JsonDecode and other functions/methods depending on it or depends are placed here temporarily, once respective package is created will be moved to it.


type AppConfig

type AppConfig struct {
	// Directories that has to be created to store application related data.
	// This will be used if filesystem is used as storage mode.
	Directories []string `json:"directories"`

	// Pass raw application configuration in a json format
	Rawconfig map[string]interface{} `json:"rawconfig"`

	// Port on which neuron has to operate.
	Port string `json:"port"`

	// Home directory or neuron.
	Home string `json:"home"`

	// Path of folder containing all the files which powers up UI.
	UiDir string `json:"uidir"`

	// Name of the log file, specify if you want to override the default name.
	LogFile string `json:"logfile"`

	// Path where logs has to be written.
	LogLocation string `json:"loglocation"`

	// By enabling this you are telling application to expose its API.
	EnableAPI bool `json:"enableapi"`

	// By enabling this you are asking neuron to serve UI.
	EnableUI bool `json:"enableui"`

	// It holds the details of the database that has to be connected with neuron.
	Database []*db `json:"database"`

	Cloud []*Cloud

AppConfig holds the entire confiration of the application neuron, while reading config file we decode the configuration to this struct below.

type CliMeta

type CliMeta struct {
	CliSet bool

CliMeta holds data whether cli is enabled along with decoded config.

func GetCliMeta

func GetCliMeta(path ...string) (CliMeta, error)

GetCliMeta will be give back data of type CliMeta, to help decision making while we initialize cli. Be sure what you pass as path to this, because only the first element is considered while setting path.

type Cloud

type Cloud struct {
	Name    string `json:"name"`
	Region  string `json:"region"`
	Default bool   `json:"default"`

Cloud holds the details of the cloud, this will be set in the configuration.

type ConfigResponse

type ConfigResponse struct {
	Port           string
	UiDir          string
	UiTemplatePath string
	ApiLogPath     io.Writer
	NoUi           bool
	EnableAPI      bool

ConfigResponse will be the response type of function Init.

func Init

func Init(path ...string) (ConfigResponse, error)

Init will configure the application by reading the configuration file at '/var/lib/neuron'. Be sure what you pass as path to this, because only the first element is considered while setting path.

Jump to

Keyboard shortcuts

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