Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Settings

Config class adds setter and getter logic to validate certain settings

Hierarchy

  • Settings

Index

Properties

config

config: Arguments = this.loadConfig(true)

Access all settings from argv, env, package.json and custom config file

options

options: object = Object.assign({}, initOptions)

Type declaration

  • [key: string]: Options

Accessors

alias

  • get alias(): string
  • set alias(name: string): void
  • Shortcut to loaded bot alias config

    Returns string

  • Shortcut to setting alias with validation

    Parameters

    • name: string

    Returns void

name

  • get name(): string
  • set name(name: string): void
  • Shortcut to loaded bot name config

    Returns string

  • Shortcut to setting name with validation

    Parameters

    • name: string

    Returns void

Methods

extend

  • extend(options: object): void
  • Add more options after load

    Parameters

    • options: object
      • [key: string]: Options

    Returns void

get

  • get(key: string): any
  • Generic config getter

    Parameters

    • key: string

    Returns any

loadConfig

  • loadConfig(reset?: boolean): Arguments
  • Combine and load config from command line, environment and JSON if provided. The returned argv object will copy any options given using param alias into the main attribute, or use defaults if none assigned. The option values are then assigned to the config object (some are nullable).

    Parameters

    • Default value reset: boolean = false

    Returns Arguments

reloadConfig

  • reloadConfig(): void
  • Allow reloading config after options update

    Returns void

resetConfig

  • resetConfig(): void

safeName

  • safeName(name: string): string
  • Validate name, stripping special characters

    Parameters

    • name: string

    Returns string

set

  • set(key: string, value: any): void
  • Generic config setter (@todo this is kinda whack)

    Parameters

    • key: string
    • value: any

    Returns void

unset

  • unset(key: string): void
  • Generic config clear

    Parameters

    • key: string

    Returns void

Generated using TypeDoc