cfg

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildNo = "1811"
View Source
var IsBSD = false
View Source
var IsLinux = true
View Source
var IsUnix = true
View Source
var IsWindows = false
View Source
var PostDbConnectChecks []PostDbType
View Source
var ReservedItems = map[string]bool{
	"$auth_key$":                  true,
	"$email$":                     true,
	"$is_logged_in$":              true,
	"$is_enc_logged_in$":          true,
	"$$host_name$$":               true,
	"$is_full_login$":             true,
	"$privs$":                     true,
	"$saved_one_time_key_hashed$": true,
	"$user_id$":                   true,
	"$customer_id$":               true,
	"$username$":                  true,
	"$session$":                   true,
	"$ip_sha256$":                 true,
}
View Source
var ServerName = "Go-FTL"
View Source
var ServerType = "Go-FTL"
View Source
var ServersMutex sync.Mutex
View Source
var Version = "0.5.9"

Functions

func IsInputValid

func IsInputValid(mid_name string, ValidationDataJson string, data map[string]interface{}) (eok bool, dflt map[string]interface{}, msg string)

func MapJsonToStruct

func MapJsonToStruct(data map[string]interface{}, dflt map[string]interface{}, ms interface{}) (err error)

Data is input data dflt is set of default values where not specified ms is the struct to map to

func ReadGlobalConfigFile

func ReadGlobalConfigFile(fn string)

func ResolvLocalFile

func ResolvLocalFile(fn string) (outFn string)

func SetupEmptyForTest

func SetupEmptyForTest() bool

func SetupPgSqlForTest

func SetupPgSqlForTest(test_cfg string) bool

func SetupRedisForTest

func SetupRedisForTest(test_cfg string) bool

Types

type ListenToType

type ListenToType struct {
	Protocal string // http or https
	Port     string // 3000
	Domain   string // localhost, www.test1.com etc. (the IP address)
	HasWild  bool   // True if *.test1.com
}

---- Configuration Files ----------------------------------------------------------------------------------------------------

type LoggingConfigType

type LoggingConfigType struct {
	FileOn  string
	RedisOn string
}

type PerServerConfigType

type PerServerConfigType struct {
	Name           string                 `gfJsonX:"-"`          // name for this server -- PerServerConfigType/cfg.go:109
	LineNo         int                    `gfJsonX:"-"`          // Start line number for this config
	FileName       string                 `gfJsonX:"-"`          // File name this config came from
	ListenTo       []string               `gfJsonX:"listen_to"`  // URL to listen to
	Certs          []string               `gfJsonX:"certs"`      // Certs if https, wss
	Port           []string               `gfJsonX:"-"`          // port for URL
	ListenToParsed []ListenToType         `gfJsonX:"-"`          // parsed url
	Plugins        interface{}            `gfJsonX:"-"`          //
	ConfigData     map[string]interface{} `gfJsonX:"ConfigData"` // Any other config info
}

type PerServerConfigType_old

type PerServerConfigType_old struct {
	Name           string                 `json:"-"`          // name for this server -- PerServerConfigType/cfg.go:109
	LineNo         int                    `json:"-"`          // Start line number for this config
	FileName       string                 `json:"-"`          // File name this config came from
	ListenTo       []string               `json:"listen_to"`  // URL to listen to
	Certs          []string               `json:"certs"`      // Certs if https, wss
	Port           []string               `json:"-"`          // port for URL
	ListenToParsed []ListenToType         `json:"-"`          // parsed url
	Plugins        interface{}            `json:"-"`          //
	ConfigData     map[string]interface{} `json:"ConfigData"` // Any other config info
}

type PostDbType

type PostDbType struct {
	RunCheck func(conn *sizlib.MyDb) bool
}

type ServerGlobalConfigType

type ServerGlobalConfigType struct {
	ServerName       string            `gfJsonX:"server_name" gfDefault:"Go-FTL Server"`  //
	DebugFlags       []string          `gfJsonX:"debug_flags"`                            //
	TraceFlags       []string          `gfJsonX:"trace_flags"`                            //
	DefaultStatic    string            `gfJsonX:"default_static" gfDefault:"./static"`    //
	RedisConnectHost string            `gfJsonX:"RedisConnectHost" gfDefault:"127.0.0.1"` // Connection info for Redis Database
	RedisConnectPort string            `gfJsonX:"RedisConnectPort" gfDefault:"6379"`      //
	RedisConnectAuth string            `gfJsonX:"RedisConnectAuth"`                       //
	PGConn           string            `gfJsonX:"PGConn"`                                 //
	DBType           string            `gfJsonX:"DBType" gfDefault:"postgres"`            //
	DBName           string            `gfJsonX:"DBName" gfDefault:"pschlump"`            //
	LoggingConfig    LoggingConfigType `gfJsonX:"LoggingConfig"`                          //
	RedisPool        *pool.Pool        `gfJsonX:"-"`                                      // Pooled Redis Client connection information

	Pg_client *sizlib.MyDb `gfJsonX:"-"` //                                   // Client connection for PostgreSQL

	Config map[string]PerServerConfigType //                                                 //Anything that did not match the above JSON names //
	// contains filtered or unexported fields
}
var ServerGlobal ServerGlobalConfigType

func (*ServerGlobalConfigType) ConnectToPostgreSQL

func (sgct *ServerGlobalConfigType) ConnectToPostgreSQL() bool

ConnectToPostgreSQL will take global connection information and connect to the database.

func (*ServerGlobalConfigType) ConnectToRedis

func (sgct *ServerGlobalConfigType) ConnectToRedis() bool

----------------------------------------------------------------------------------------------------------------------------

func (*ServerGlobalConfigType) DbOn

func (sgct *ServerGlobalConfigType) DbOn(server, module, flag string) bool

func (*ServerGlobalConfigType) DbSetup

func (sgct *ServerGlobalConfigType) DbSetup()

Return true if the debuging flag is enabled for this set of module/server/flag

Example: pass "godebug.FILE()" for the module, "localhost" for the server and "db_CORS_login" for the flag.

  the enabled flag is "CORS/localhost:.*/db_CORS.*
	This should result in a "true" return.

1. Get MiddlwareName form FileName 2. Match of Flag

ExampleFlag:

http://localhost:8088/SessionRedis/db1
Server: http://localhost:8088
Module: SessionRedis
Flag: db1

func (*ServerGlobalConfigType) GetKeys

func (sgct *ServerGlobalConfigType) GetKeys(theKey string) []string

----------------------------------------------------------------------------------------------------------------------------

type VType

type VType struct {
	Type      []string `gfJsonX:"type"`      // One of the types, string, int, float, filepath, url, bool,
	IsArray   bool     `gfJsonX:"isarray"`   // Convert single item to array 1 long
	Required  bool     `gfJsonX:"required"`  // Must be suplied
	Default   string   `gfJsonX:"default"`   // A string that can be converted into a value if not supplied - implies that Required is meangless
	List      []string `gfJsonX:"list"`      // Must be one of the listed values
	ReMatch   string   `gfJsonX:"rematch"`   // Must match the regular expression
	MinValInt int      `gfJsonX:"minvalint"` // Must be g.e. this value
	MaxValInt int      `gfJsonX:"maxvalint"` // Must be l.e. this value
	Allowed   bool     `gfJsonX:"allowed"`   // Is extra allowed?
	MinLength int      `gfJsonX:"minlength"` // String MinLen, MaxLen
	MaxLength int      `gfJsonX:"maxlength"` //
	// contains filtered or unexported fields
}

type ValidationType

type ValidationType map[string]VType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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