# Configuration

Sometimes you need to configure your module and have a different configuration for different environments. QA vs Production for example.

You can use the Backoffice to set the configuration key/values:

![](https://4257661311-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkpyTqJi517UiwFJJRydZ%2Fuploads%2Fgit-blob-826f09b6c4b3149d5be31fad2f621c27c8b54a8a%2FAppmixer_Backoffice_-_Service_Configuration%20\(7\).png?alt=media)

The *key* to the Backoffice Service Configuration depends on the component.json. If it is a component with *auth* section, then the *key* is the *service.* Let's take a Slack component.json for example:

```
{
    "name": "appmixer.slack.list.NewChannelMessageRT",
    "description": "As opposed to NewChannelMessage and NewPrivateChannelMessage this trigger fires immediately every time a message is posted to a channel. Works both for public and private channels.",
    "webhook": true,
    "auth": {
        "service": "appmixer:slack",  // appmixer:slack will be used as a 'key'
        "scope": [
            "channels:read",
            "channels:history"
        ]
    },
    "outPorts": [
    ...
}
```

In this case, the *appmixer:slack* will be used as a key into the Backoffice. Then you can store various key/value pairs in the Service Configuration:

![](https://4257661311-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkpyTqJi517UiwFJJRydZ%2Fuploads%2Fgit-blob-de63cc6536555397712ca9418d65475e420f04f6%2FAppmixer_Backoffice_-_Service_Configuration%20\(29\).png?alt=media)

A good example is the *clientID* and *clientSecret*. Slack is an Oauth2 application and it needs a different Oauth application for each environment (due to the redirect URL). All of these values will be available in the component's *context* object (and in the *context* object in the auth.js file as well).

```
module.exports = {

    async tick(context) {
    
        context.auth.clientId;
        context.auth.clientSecret;
        context.auth.orAnythingElse;
        
        // all of those will be available at context.config as well
        context.config.clientId;
        context.config.clientSecret;
        context.config.orAnythingElse;        
    }
}
```

If your component/module does not use user authentication (no *auth* section in the component.json file), then the *key* to the Backoffice Service Configuration depends on the *name* of the component. Here's an example.

```
// component.json file without "auth" section
{
    // the property "name" will be used to look for configuration stored through
    // the Backoffice. Appmixer will try to look for a key [vendor]:[service] and
    // [vendor]:[service]:[module]
    "name": "appmixer.utils.tasks.RequestApprovalEmail",
    "description": "People Task is a feature of Appmixer that allows human interaction inside workflows.",
    "webhook": true,
    "inPorts": [
        {
   ...
}
```

For such component/module you can store configuration under *appmixer:utils* or under *appmixer:utils:tasks*. Such key/value configuration pairs will be then available under *context.config.*
