Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Configuration for JS

Patrick edited this page Mar 29, 2021 · 11 revisions

7Facette Configuration

Configuration File

7Facette provides the possibility of using configuration files. In your config folder create a file called facetteConfig.json. This JSON-File has the following structure:

{
    "sevenFacette": {
        "log": {
            "level": "INFO"
        },
         "http": {
            "clients": {
                "testClient": {
                    "url": {
                        "baseUrl": "conduit.productionready.io/api",
                        "protocol": "https"
                    }
                }
            }
        },
        "kafka": {
            "bootstrapServer": "localhost:9092",
            "consumer": {
                "testConsumer": {
                    "useSASLAuthentication": false,
                    "autoOffset": "earliest",
                    "topicName": "test", 
                    "maxConsumingTime": 60000
                },
                "topic2": {
                    "autoOffset": "earliest",
                    "bootstrapServer": "development-kafka.de:9191"
                }
            },
            "producer": {
                "testProducer": {
                    "useSASLAuthentication": false,
                    "autoOffset": "latest",
                    "topicName": "test"
                }
            }
        },
        "application": {
            "resources": [
                {
                    "name": "db1",
                    "path": "/database/db1/"
                },
                {
                    "name": "postgres",
                    "path": "/database/db2/"
                },
                {
                    "name": "testdb",
                    "path": "/rest/db3/"
                }
            ]
        },
        "custom": {
            "test": "test"
        }
    }
}

Environments - using different files

If multiple environments exist, different configuration files can be created - one for each environment. To use different files set an environment variable FACETTE_CONFIG with the corresponding filename as value. By this, the chosen file will be used.

Log Levels

7Facette provides the following log levels with colour codes:

NONE (default)
ERROR (red)
WARN  (yellow)
INFO  (white)
DEBUG (white)

Environment variables

In different cases, it is recommended to use environment variables, e.g. for usernames and passwords. You can use these variables by typing

[[variableName]] like this: "baseUrl": "[[BASE_URL]]"

inside the JSON file. There is also the possibility to use default values as a fallback. They are inside the square brackets separated from the variable name by pipes [[variableName || fallback value]].