Documentation
¶
Index ¶
- Variables
- func IsInputValid(mid_name string, ValidationDataJson string, data map[string]interface{}) (eok bool, dflt map[string]interface{}, msg string)
- func MapJsonToStruct(data map[string]interface{}, dflt map[string]interface{}, ms interface{}) (err error)
- func ReadGlobalConfigFile(fn string)
- func ResolvLocalFile(fn string) (outFn string)
- func SetupEmptyForTest() bool
- func SetupPgSqlForTest(test_cfg string) bool
- func SetupRedisForTest(test_cfg string) bool
- type ListenToType
- type LoggingConfigType
- type PerServerConfigType
- type PerServerConfigType_old
- type PostDbType
- type ServerGlobalConfigType
- func (sgct *ServerGlobalConfigType) ConnectToPostgreSQL() bool
- func (sgct *ServerGlobalConfigType) ConnectToRedis() bool
- func (sgct *ServerGlobalConfigType) DbOn(server, module, flag string) bool
- func (sgct *ServerGlobalConfigType) DbSetup()
- func (sgct *ServerGlobalConfigType) GetKeys(theKey string) []string
- type VType
- type ValidationType
Constants ¶
This section is empty.
Variables ¶
var BuildNo = "1811"
var IsBSD = false
var IsLinux = true
var IsUnix = true
var IsWindows = false
var PostDbConnectChecks []PostDbType
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, }
var ServerName = "Go-FTL"
var ServerType = "Go-FTL"
var ServersMutex sync.Mutex
var Version = "0.5.9"
var Wg sync.WaitGroup
Functions ¶
func IsInputValid ¶
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 SetupEmptyForTest ¶
func SetupEmptyForTest() bool
func SetupPgSqlForTest ¶
func SetupRedisForTest ¶
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 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 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
}