Documentation ¶
Index ¶
- Constants
- Variables
- type AllPermissionResponse
- type BaseCollection
- type CacheResponse
- type CachedItem
- type Credentials
- type DBAbstractRowSet
- type DBColumn
- type DBRowCount
- type DBRowSet
- type LogTextResponse
- type LoggingItem
- type LoggingResponse
- type LogonResponse
- type PermissionObject
- type RemoteStatusResponse
- type RestStatusResponse
- type ServerInfo
- type ServerStatus
- type Table
- type TableColumnsInfo
- type TableInfo
- type User
- type UserCollection
Constants ¶
const ( // The prefix for all configuration keys reserved to Ego. PrivilegedKeyPrefix = "ego." // File system location used to locate services, lib, // and test directories. EgoPathSetting = PrivilegedKeyPrefix + "runtime.path" // Do we normalize the case of all symbols to a common // (lower) case string. If not true, symbol names are // case-sensitive. CaseNormalizedSetting = PrivilegedKeyPrefix + "compiler.normalized" // What is the output format that should be used by // default for operations that could return either // "text" , "indented", or "json" output. OutputFormatSetting = PrivilegedKeyPrefix + "console.format" // ConsoleHistorySetting is the name of the readline console history // file. This contains a line of text for each command previously read // using readline. If not specified in the profile, a default is used. ConsoleHistorySetting = PrivilegedKeyPrefix + "console.history" // If true, the script language includes language // extensions such as print, call, try/catch. ExtensionsEnabledSetting = PrivilegedKeyPrefix + "compiler.extensions" // Should an interactive session automatically import // all the pre-defined packages? AutoImportSetting = PrivilegedKeyPrefix + "compiler.import" // Should the interactive RUN mode exit when the user // enters a blank line on the console? ExitOnBlankSetting = PrivilegedKeyPrefix + "console.exit.on.blank" // Should the copyright message be omitted when in // interactive prompt mode? NoCopyrightSetting = PrivilegedKeyPrefix + "console.no.copyright" // Should the interactive command input processor use // readline? UseReadline = PrivilegedKeyPrefix + "console.readline" // Set to true if the full stack should be listed during // tracing. FullStackListingSetting = PrivilegedKeyPrefix + "compiler.full.stack" // Should the bytecode generator attempt an optimization pass? OptimizerSetting = PrivilegedKeyPrefix + "compiler.optimize" // Should the Ego program(s) be run with "strict" or // "dynamic" typing? The default is "dynamic". StaticTypesSetting = PrivilegedKeyPrefix + "compiler.types" // The base URL of the Ego server providing application services. This // is normally the same as the logon server, but may be set differently // if the logon services are hosted on a different server. ApplicationServerSetting = PrivilegedKeyPrefix + "application.server" // The base URL of the Ego server providing logon services. LogonServerSetting = PrivilegedKeyPrefix + "logon.server" // The last token created by a ego logon command, which // is used by default for server admin commands as well // as rest calls. LogonTokenSetting = PrivilegedKeyPrefix + "logon.token" // Stores the expiration date from the last login. This can be // used to detect an expired token and provide a better message // to the client user than "not authorized". LogonTokenExpirationSetting = PrivilegedKeyPrefix + "logon.token.expiration" // The default user if no userdatabase has been initialized // yet. This is a strong of the form "user:password", which // is defined as the root user. DefaultCredentialSetting = PrivilegedKeyPrefix + "server.default-credential" // If present, this user is always assigned super-user (root) // privileges regardless of the userdata settings. This can be // used to access an encrypted user data file. LogonSuperuserSetting = PrivilegedKeyPrefix + "server.superuser" // The file system location where the user database is stored. LogonUserdataSetting = PrivilegedKeyPrefix + "server.userdata" // The encryption key for the userdata file. If not present, // the file is not encrypted and is readable json. LogonUserdataKeySetting = PrivilegedKeyPrefix + "server.userdata.key" // The URL path for the tables database functionality. TablesServerDatabase = PrivilegedKeyPrefix + "server.database.url" // The user:password credentials to use with the local tables database. TablesServerDatabaseCredentials = PrivilegedKeyPrefix + "server.database.credentials" // The name of the tables database in the local database store (schemas // are used to partition this database by Ego username). TablesServerDatabaseName = PrivilegedKeyPrefix + "server.database.name" // Boolean indicating if the communication with the tables database // should be done using SSL secured communications. TablesServerDatabaseSSLMode = PrivilegedKeyPrefix + "server.database.ssl" // The URL path for the tables database functionality. TablesServerEmptyFilterError = PrivilegedKeyPrefix + "server.database.empty.filter.error" // The URL path for the tables database functionality. TablesServerEmptyRowsetError = PrivilegedKeyPrefix + "server.database.empty.rowset.error" // If true, the insert of a row _must_ specify all values in the table. TableServerPartialInsertError = PrivilegedKeyPrefix + "server.database.partial.insert.error" // The key string used to encrypt authentication tokens. ServerTokenKeySetting = PrivilegedKeyPrefix + "server.token.key" // A string indicating the duration of a token before it is // considered expired. Examples are "15m" or "24h". ServerTokenExpirationSetting = PrivilegedKeyPrefix + "server.token.expiration" // A string indicating the default logging to be assigned to a server that is // started without an explicit --log setting. ServerDefaultLogSetting = PrivilegedKeyPrefix + "server.default.logging" // How many old logs do we maintain by default when in server mode? LogRetainCountSetting = PrivilegedKeyPrefix + "server.retain.log.count" // If true, the util.Exec() function can be executed to run an arbitrary // native shell command. This defaults to being disabled. ExecPermittedSetting = PrivilegedKeyPrefix + "runtime.exec" // Default allocation factor to set on symbol table create/expand // operations. Larger numbers are more efficient for larger symbol // tables, but too large a number wastes time and memory. SymbolTableAllocationSetting = PrivilegedKeyPrefix + "runtime.symbol.allocation" // If true, functions that return multiple values including an // error that do not assign that error to a value will result in // the error being thrown. ThrowUncheckedErrorsSetting = PrivilegedKeyPrefix + "runtime.unchecked.errors" // If true, then an error with a message string that starts with "!" will // cause an actual go panic abend. RuntimePanicsSetting = PrivilegedKeyPrefix + "runtime.panics" // If true, the TRACE operation will print the full stack instead of // a shorter single-line version. FullStackTraceSetting = PrivilegedKeyPrefix + "runtime.stack.trace" // If specified, has the Go-style format string to be used for log // messages showing the time of the event. LogTimestampFormat = PrivilegedKeyPrefix + "log.timestamp" // If specified, all filename references in ego programs (such as the // ReadFile() function) must start with this path, or it will be prefixed // with this path. This lets you limit where/how the files can be managed // by an ego program. This is especially important in server mode. SandboxPathSetting = PrivilegedKeyPrefix + "sandbox.path" // PidDirectorySettings has the path used to store and find PID files for // server invocations and management. PidDirectorySetting = PrivilegedKeyPrefix + "server.piddir" // If true, the default state for staring an Ego is to not require HTTPS/SSL // but rather run in "insecure" mode. InsecureServerSetting = PrivilegedKeyPrefix + "server.insecure" // Maximum cache size for server cache. The default is zero, no caching // performed. MaxCacheSizeSetting = PrivilegedKeyPrefix + "server.cache.size" // Do we automatically process non-success ErrorResponse payloads from // client REST calls as if they were the return code value? Default is // true. RestClientErrorSetting = PrivilegedKeyPrefix + "runtime.rest.errors" )
This section describes the profile keys used by Ego.
const ( AutoImportOption = "auto-import" DisassembleOption = "disassemble" FullSymbolScopeOption = "full-symbol-scope" TypingOption = "types" SymbolTableSizeOption = "symbol-allocation" OptimizerOption = "optimize" )
This section contains the names of the command-line options. These often (but not always) have parallels in the settings above. Settings typically have a structured name (ego.compiler.autoimport) while the option name is Unix shell-friendly (auto-import).
const ( AdminAgent = "admin" ClientAgent = "rest client" LogonAgent = "logon" StatusAgent = "status" TableAgent = "tables" )
Agent identifiers for REST calls, which indicate the role of the client.
const ( True = "true" False = "false" Any = "any" Strict = "strict" Loose = "relaxed" Dynamic = "dynamic" Main = "main" )
const ( ByteCodeReflectionTypeString = "<*bytecode.ByteCode Value>" TypeCheckingVariable = InvisiblePrefix + "type_checking" StrictTypeEnforcement = 0 RelaxedTypeEnforcement = 1 NoTypeEnforcement = 2 InvisiblePrefix = "__" ThisVariable = InvisiblePrefix + "this" MainVariable = InvisiblePrefix + "main" ErrorVariable = InvisiblePrefix + "error" ArgumentListVariable = InvisiblePrefix + "args" CLIArgumentListVariable = InvisiblePrefix + "cli_args" ModeVariable = InvisiblePrefix + "exec_mode" DebugServicePathVariable = InvisiblePrefix + "debug_service_path" PathsVariable = InvisiblePrefix + "paths" LocalizationVariable = InvisiblePrefix + "localization" LineVariable = InvisiblePrefix + "line" ModuleVariable = InvisiblePrefix + "module" RestStatusVariable = InvisiblePrefix + "rest_status" DiscardedVariable = "_" ReadonlyVariablePrefix = "_" VersionName = ReadonlyVariablePrefix + "version" CopyrightVariable = ReadonlyVariablePrefix + "copyright" InstanceUUIDVariable = ReadonlyVariablePrefix + "server_instance" BuildTimeVariable = ReadonlyVariablePrefix + "buildtime" PlatformVariable = ReadonlyVariablePrefix + "platform" )
const ( TableParameterName = "table" SchemaParameterName = "schema" UserParameterName = "user" ColumnParameterName = "columns" FilterParameterName = "filter" SortParameterName = "sort" StartParameterName = "start" LimitParameterName = "limit" RowCountParameterName = "rowcounts" AbstractParameterName = "abstract" )
const ( AdminCachesPath = "/admin/caches" AdminHeartbeatPath = "/admin/heartbeat" AdminLoggersPath = "/admin/loggers/" AdminUsersPath = "/admin/users/" AdminUsersNamePath = AdminUsersPath + "%s" AssetsPath = "/assets/" CodePath = "/code" ServicesPath = "/services/" ServicesLogonPath = ServicesPath + "admin/logon/" ServicesUpPath = ServicesPath + "up/" TablesPath = "/tables/" TablesNamePath = TablesPath + "%s" TablesRowsPath = TablesNamePath + "/rows" TablesSQLPath = TablesPath + "@sql" TablesPermissionsPath = TablesPath + "@permissions" TablesNamePermissionsPath = TablesNamePath + "/permissions" )
const ( TextMediaType = "application/text" JSONMediaType = "application/json" HTMLMediaType = "application/html" EgoMediaType = "application/vnd.ego." SQLStatementsMediaType = EgoMediaType + "sql+json" RowSetMediaType = EgoMediaType + "rows+json" AbstractRowSetMediaType = EgoMediaType + "rows.abstract+json" RowCountMediaType = EgoMediaType + "rowcount+json" TableMetadataMediaType = EgoMediaType + "columns+json" TablesMediaType = EgoMediaType + "tables+json" ErrorMediaType = EgoMediaType + "error+json" UserMediaType = EgoMediaType + "user+json" UsersMediaType = EgoMediaType + "users+json" LogStatusMediaType = EgoMediaType + "log.status+json" LogLinesMediaType = EgoMediaType + "log.lines+json" CacheMediaType = EgoMediaType + "cache+json" )
const ( UserAuthenticationRequired = "user" TokenRequired = "token" AdminAuthneticationRequired = "admin" AdminTokenRequired = "admintoken" )
const (
APIVersion = 1
)
const Anon = "<anon>"
This is the name for objects that otherwise have no name.
const AuthScheme = "bearer "
The authorization scheme attached to the bearer token in REST calls.
const DefaultUserdataFileName = "sqlite3://users.db"
DefaultUserdataFileName is the default file system name of the user database file, if not specified by the user.
const EgoDefaultLogFileName = "EGO_LOG_FILE"
The environment variable that contains the name to use for writing log file messages. If not specified, defaults to writing to stdout.
const EgoDefaultLogging = "EGO_DEFAULT_LOGGING"
The environment variable that contains the name(s) of the loggers that are to be enabled by default at startup (before command line processing).
const EgoFilenameExtension = ".ego"
The file extension for Ego programs".
const EgoLogEnv = "EGO_LOG"
The environment variable that contains the path to which the log file is written.
const EgoPathEnv = "EGO_PATH"
The environment variable that defines where the runtime files are to be found.
const LibPathName = "lib"
The subdirectory in "EGO_PATH" where the .ego runtime files and assets are found.
const LocalHost = "localhost"
Name of the default local host, in TCP/IP standards.
const RowIDName = "_row_id_"
This is the name of a column automatically added to tables created using the 'tables' REST API.
Variables ¶
var ServerInstanceID string
ServerInstanceID is the UUID of the current Server Instance.
var TableColumnTypeNames []string = []string{
"int",
"int32",
"int64",
"string",
"float",
"double",
"float32",
"float64",
"time",
"timestamp",
"date",
"bool",
}
var ValidSettings map[string]bool = map[string]bool{ EgoPathSetting: true, CaseNormalizedSetting: true, OutputFormatSetting: true, ExtensionsEnabledSetting: true, AutoImportSetting: true, ExitOnBlankSetting: false, NoCopyrightSetting: false, UseReadline: true, FullStackListingSetting: true, StaticTypesSetting: true, ApplicationServerSetting: false, LogonServerSetting: true, LogonTokenSetting: false, LogonTokenExpirationSetting: false, DefaultCredentialSetting: true, LogonSuperuserSetting: true, LogonUserdataSetting: true, LogonUserdataKeySetting: true, TablesServerDatabase: true, TablesServerDatabaseCredentials: true, TablesServerDatabaseName: true, TablesServerDatabaseSSLMode: true, ServerTokenKeySetting: true, ServerTokenExpirationSetting: true, ThrowUncheckedErrorsSetting: true, FullStackTraceSetting: true, LogTimestampFormat: true, SandboxPathSetting: true, PidDirectorySetting: true, InsecureServerSetting: true, MaxCacheSizeSetting: true, RestClientErrorSetting: true, LogRetainCountSetting: true, RuntimePanicsSetting: true, TablesServerEmptyFilterError: true, TablesServerEmptyRowsetError: true, ServerDefaultLogSetting: true, TableServerPartialInsertError: true, SymbolTableAllocationSetting: true, ExecPermittedSetting: true, OptimizerSetting: true, }
ValidSettings describes the list of valid settings, and whether they can be set by the command line.
Functions ¶
This section is empty.
Types ¶
type AllPermissionResponse ¶
type AllPermissionResponse struct { ServerInfo `json:"server"` Permissions []PermissionObject `json:"permissions"` Count int `json:"count"` }
type BaseCollection ¶
type BaseCollection struct { ServerInfo `json:"server"` Count int `json:"count"` Start int `json:"start"` }
BaseCollection is a component of any collection type returned as a response.
type CacheResponse ¶
type CacheResponse struct { ServerInfo `json:"server"` Count int `json:"count"` Limit int `json:"limit"` Items []CachedItem `json:"items"` AssetCount int `json:"assets"` AssetSize int `json:"assetSize"` }
CacheResponse describes the response object returned from the /admin/caches endpoint.
type CachedItem ¶
type Credentials ¶
type DBAbstractRowSet ¶
type DBAbstractRowSet struct { ServerInfo `json:"server"` Columns []string `json:"columns"` Rows [][]interface{} `json:"rows"` Count int `json:"count"` }
type DBRowCount ¶
type DBRowCount struct { ServerInfo `json:"server"` Count int `json:"count"` }
type DBRowSet ¶
type DBRowSet struct { ServerInfo `json:"server"` Rows []map[string]interface{} `json:"rows"` Count int `json:"count"` }
type LogTextResponse ¶
type LogTextResponse struct { ServerInfo `json:"server"` Lines []string `json:"lines"` }
type LoggingItem ¶
type LoggingResponse ¶
type LoggingResponse struct { ServerInfo `json:"server"` LoggingItem }
type LogonResponse ¶
type LogonResponse struct { ServerInfo `json:"server"` Expiration string `json:"expires"` Token string `json:"token"` Identity string `json:"identity"` }
LogonResponse is the info returned from a logon request.
type PermissionObject ¶
type RemoteStatusResponse ¶
type RemoteStatusResponse struct { ServerInfo `json:"server"` Version string `json:"version"` Pid int `json:"pid"` Since string `json:"since"` }
The payload for the status check "/up" endpoint.
type RestStatusResponse ¶
type RestStatusResponse struct { ServerInfo `json:"server"` Status int `json:"status"` Message string `json:"msg"` }
RestStatusResponse describes the HTTP status result and any helpful additional message. This must be part of all response objects.
type ServerInfo ¶
type ServerStatus ¶
type ServerStatus struct { ServerInfo `json:"server"` Version string `json:"version"` PID int `json:"pid"` Started time.Time `json:"started"` LogID uuid.UUID `json:"logID"` Args []string `json:"args"` }
ServerStatus describes the state of a running server. A json version of this information is the contents of the pid file.
type TableColumnsInfo ¶
type TableColumnsInfo struct { ServerInfo `json:"server"` Columns []DBColumn `json:"columns"` Count int `json:"count"` }
type TableInfo ¶
type TableInfo struct { ServerInfo `json:"server"` Tables []Table `json:"tables"` Count int `json:"count"` }
type User ¶
type User struct { Name string `json:"name"` ID uuid.UUID `json:"id,omitempty"` Password string `json:"password,omitempty"` Permissions []string `json:"permissions,omitempty"` }
User describbes a single user in the user database. The password field must be removed from response objects.
type UserCollection ¶
type UserCollection struct { BaseCollection Items []User `json:"items"` }
UserCollection is a collection of User response objects.