Configurations

Version 3.x

Basic Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var rs = require('http/v3/rs');
var configurations = require('core/v3/configurations');

rs.service()
  .resource("")
    .get(function(ctx, request, response) {
      let credentials = {
        'envVar1': configurations.get('ENV_VAR_1'),
        'envVar2': configurations.get('ENV_VAR_2')
      };
      response.println(JSON.stringify(credentials));
    }).put(function(ctx, request, response) {
      let credentials = request.getJSON();
      configurations.set('ENV_VAR_1', credentials.envVar1);
      configurations.set('ENV_VAR_2', credentials.envVar2);
    })
  .execute();

Definition

Functions


Function Description Returns
get(key, defaultValue)() Returns the value for the specified key, or the default value string
set(key, value) Sets a value, for the specified key -
getKeys() Returns an arrays of keys array of string
load(path) Loads a configuration from a properties file at path -
update() Updates the loaded configurations -

Compatibility

Rhino Nashorn V8
βœ… βœ… βœ…

Edit