core/nativesettings

Types

Settings = ref object
  address*: string           ## The address of socket.
  port*: Port                ## The port of socket.
  debug*: bool               ## Debug mode(true is yes).
  reusePort*: bool           ## Use socket port in multiple times.
  bufSize*: int              ## Buffer size of sending static files.
  data: JsonNode             ## Data which carries user defined settings.
  
Global settings for all handlers.   Source Edit
CtxSettings = ref object
  mimeDB*: MimeDB
  config*: TableRef[string, StringTableRef]
Context settings.   Source Edit

Procs

proc loadSettings(configPath: string): Settings {...}{.raises: [KeyError,
    EmptySecretKeyError, IOError, OSError, ValueError, JsonParsingError,
    Exception], tags: [ReadIOEffect, WriteIOEffect].}
Creates a new Settings.   Source Edit

Funcs

func hasKey(settings: Settings; key: string): bool {...}{.inline, raises: [],
    tags: [].}
Returns true if key is in settings.   Source Edit
func `[]`(settings: Settings; key: string): JsonNode {...}{.inline,
    raises: [KeyError], tags: [].}
Retrieves value if key is in settings.   Source Edit
func getOrDefault(settings: Settings; key: string): JsonNode {...}{.inline,
    raises: [], tags: [].}
Retrieves value if key is in settings. Otherwise nil will be returned.   Source Edit
func newCtxSettings(): CtxSettings {...}{.raises: [], tags: [].}
Creates a new context settings.   Source Edit
func newSettings(address = ""; port = Port(8080); debug = true;
                 reusePort = true; secretKey = randomString(8); appName = "";
                 bufSize = 40960): Settings {...}{.inline,
    raises: [EmptySecretKeyError], tags: [].}
Creates a new Settings.   Source Edit
func loadSettings(data: JsonNode): Settings {...}{.
    raises: [KeyError, EmptySecretKeyError], tags: [].}
Creates a new Settings.   Source Edit