# Config

```javascript
const config = require('config')
```

The config module serves as general purpose key/value storage for organization configuration and secrets.

Configuration keys can be exported and imported using the developer tools when *they are named using namespace rules* (c\_ or namespace\_\_) to keep local secrets out of version control. Config keys can also be included in Deployments.

{% hint style="success" %}
An organization can store around 256k of config data.
{% endhint %}

{% hint style="warning" %}
There are no access controls surrounding config data in-script.
{% endhint %}

## module Config

### keys()

Returns the list of configuration keys.

*Returns*

* { String\[] } An array of configuration keys.

### get(key)

Returns the value for a configuration key. The key can also be an object property path.

*Arguments*

* `key` { String } The key name or object property path.

*Returns*

* { \* } The key value.

### set(key, val)

Set the value for a configuration key.

*Arguments*

* `key` { String } The key name or object property path.
* `val` { \* = *null* } The value. Overwrites the value at `key`. If null, unsets the value at `key`.

*Returns*

* { \* } The key value.

## Examples

### Using get() and set()

```javascript
const should = require('should'),
      config = require('config')

// set a top-level secret
config.set('secret', {foo: 'bar'})

// set a pathed value
config.set('secret.foo', 'baz')

// set a path object
config.set('secret.cake', {eat: 'it', too: 'yes!'})

should.equal(config.get('secret.foo'), 'baz')
should.equal(config.get('secret.cake.too'), 'yes!')
```

### Using convenience methods

The config module may also be called as a function for getting and setting values.

```javascript
const config = require('config')

// set a top-level secret
config('secret', {foo: 'bar'})

// set a pathed value
config('secret.foo', 'baz')

// set a path object
config('secret.cake', {eat: 'it', too: 'yes!'})

should.equal(config('secret.foo'), 'baz')
should.equal(config('secret.cake.too'), 'yes!')
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.medable.com/cortex-api/scripting/modules-1/config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
