Skip to main content

Configuration

Here is how you configure Secured Signal API

Environment Variables

While being a bit restrictive environment variables are a great way to configure Secured Signal API.

Suppose you want to set a new Placeholder NUMBER in your Environment...

environment:
SETTINGS__VARIABLES__NUMBER: "+123400001"

This would internally be converted into settings.variables.number matching the config formatting.

info

Underscores _ are removed during Conversion, double Underscores __ on the other hand convert the Variable into a nested Object (__ replaced by .)

Config Files

Config files are the recommended way to configure and use Secured Signal API, they are flexible, extensible and really easy to use.

Config files allow YAML formatting and also ${ENV} to get environment variables.

note

To change the internal config file location set CONFIG_PATH in your Environment to an absolute path. (default: /config/config.yml)

This example config shows all of the individual settings that can be applied:

# Example Config (all configurations shown)
service:
port: 8880

api:
url: http://signal-api:8080
tokens: [token1, token2]

logLevel: info

settings:
messageTemplate: |
You've got a Notification:
{{@message}}
At {{@data.timestamp}} on {{@data.date}}.
Send using {{.NUMBER}}.

variables:
number: "+123400001"
recipients: ["+123400002", "group.id", "user.id"]

dataAliases:
"@message": [{ alias: "msg", score: 100 }]

blockedEndpoints:
- /v1/about
allowedEndpoints:
- /v2/send

Token Configs

But wait! There is more... 😁

Token Configs are used to create per-token defined overrides and settings.

note

Create them under TOKENS_PATH (default: config/tokens/)

This way you can permission tokens by further restricting or adding Endpoints, Placeholders, etc.

Here is an example:

tokens: [LOOOONG_STRING]

overrides:
variables: # Disable Placeholder
blockedEndpoints: # Disable Sending
- /v2/send
dataAliases: # Disable Aliases