-
-
Notifications
You must be signed in to change notification settings - Fork 23
Configuration
You can configure hastic-server using either environment variables or config file.
Config variables have the following priority, from higher to lower:
- environment variables
- variables from config file
You can export the following environment variables for hastic-server to use:
-
HASTIC_API_KEY
- (required) API-key of your Grafana instance (e.g.eyJrIjoiVjZqMHY0dHk4UEE3eEN4MzgzRnd2aURlMWlIdXdHNW4iLCJuIjoiaGFzdGljIiwiaWQiOjF9
), see Get HASTIC_API_KEY -
GRAFANA_URL
- (optional) Grafana URL which can be queried from hastic-server host (e.g.http://localhost:3000
), -
HASTIC_PORT
- (optional) port you want to run server on, default:8000
-
HASTIC_WEBHOOK_URL
- (optional) use it if you want to get webhooks with new detections (e.g.http://localhost:8080
), -
HASTIC_WEBHOOK_TYPE
: (optional) can be eitherapplication/x-www-form-urlencoded
orapplication/json
,
e.g.
export HASTIC_API_KEY=eyJrIjoiVjZqMHY0dHk4UEE3eEN4MzgzRnd2aURlMWlIdXdHNW4iLCJuIjoiaGFzdGljIiwiaWQiOjF9
export HASTIC_PORT=8080
export GRAFANA_URL=http://localhost:3000
You can also set those variables in .env
file if you're using docker-compose
.env
file example:
HASTIC_API_KEY=eyJrIjoiVDRUTUlKSjJ5N3dYTDdsd1JyWWRBNHFkb0VSeDBNTTYiLCJuIjoiaGFzdGljLXNlcnZlciIsImlkIjoxfQ==
GRAFANA_URL=http://localhost:3000
This variables will be set as environment variables and will have the highest priority.
Note: variable from
.env
file will be applied only ifdocker-compose.yml
has variable name inservices.server.environment
section. Example forZMQ_CONNECTION_STRING
from Hastic's docker-compose.yml:
environment:
ZMQ_CONNECTION_STRING: ${ZMQ_CONNECTION_STRING:-tcp://analytics:8002}
You can also rename config.example.json
to config.json
and set your values there.
hastic-server config example: https://github.com/hastic/hastic-server/blob/master/config.example.json
HASTIC_DB_CONNECTION_TYPE
- database type. Can have the following values:
-
nedb
(default) - NeDB will be used as database -
mongodb
- MongoDB will be used as database
HASTIC_DB_CONNECTION_STRING
- connection-string for MongoDB (not used with nedb).
Connection-string has the following format: <db_user>:<db_password>@<db_url>/<db_name>
. For example hastic:[email protected]:27017/hastic
:
- username:
hastic
- password:
password
- mongodb-url:
mongodb.example.com:27017
- database:
hastic
To use MongoDB with Hastic:
- create DB: https://docs.mongodb.com/manual/faq/fundamentals/#how-do-i-create-a-database-and-a-collection
- create user with read / write roles on that DB: https://docs.mongodb.com/manual/reference/method/db.createUser/#create-user-with-roles