@yoda/env

Environment & configuration library. At /etc/yoda, the RT should provide a required /etc/yoda/env.json.

Before loading this module:

  • it reads the persist.sys.rokid.env value.
  • checks if /etc/yoda/env.${env}.json exists.
    • if no, returns the default(/etc/yoda/env.json) object.
  • update the default object by the given fields.

A simple example:

var env = require('@yoda/env')()
console.log(env.speechUri)

var env = require('@yoda/env').load('test')
console.log(env.speechUri) // specify to load the `env.test.json`.

Methods

(inner) get()

Get the current env object.

(inner) load(envopt) → {object}

Load the current env object by the specific env name.

Parameters:
Name Type Attributes Description
env string <optional>

specific name for that you want to load.

Returns:
Type:
object

the loaded env object.