diff --git a/docker/README.md b/docker/README.md index ec5b9917e..6e234f1e9 100644 --- a/docker/README.md +++ b/docker/README.md @@ -80,7 +80,7 @@ If you want to be able to restart/stop your container and keep the same DB `-v / * `TEST_MODE` - Only test configs (default: `false`) : `-e TEST_MODE=""` * `TZ` - Set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to ensure logs have a local timestamp. * `DISABLE_AGENT` - Only test configs (default: `false`) : `-e DISABLE_AGENT=""` -* `DISABLE_LOCAL_API` - Disable local API (default: `false`) : `-e DISABLE_API=""` +* `DISABLE_LOCAL_API` - Disable local API (default: `false`) : `-e DISABLE_LOCAL_API=""` * `DISABLE_ONLINE_API` - Disable Online API registration for signal sharing (default: `false`) : `-e DISABLE_ONLINE_API=""` * `LEVEL_TRACE` - Trace-level (VERY verbose) on stdout (default: `false`) : `-e LEVEL_TRACE=""` * `LEVEL_DEBUG` - Debug-level on stdout (default: `false`) : `-e LEVEL_DEBUG=""` diff --git a/docker/docker_start.sh b/docker/docker_start.sh index 741dda4aa..fcb3d9b5f 100644 --- a/docker/docker_start.sh +++ b/docker/docker_start.sh @@ -1,9 +1,14 @@ #!/bin/sh # Check if the container has already been started -cscli machines list | grep 127.0.0.1 -if [ $? == 1 ]; then - cscli machines add --force --auto -f /etc/crowdsec/local_api_credentials.yaml +if [ "$DISABLE_AGENT" == "" ] ; then + if [ "$LOCAL_API_URL" != "" ] ; then + cscli lapi register --url $LOCAL_API_URL + fi + cscli machines list | grep localhost + if [ $? == 1 ]; then + cscli lapi register --machine localhost + fi fi # registration to online API for signal push @@ -58,7 +63,7 @@ fi if [ "$DISABLE_AGENT" == "true" ] || [ "$DISABLE_AGENT" == "TRUE" ]; then ARGS="$ARGS -no-cs" fi -if [ "$DISABLE_API" == "true" ] || [ "$DISABLE_API" == "TRUE" ]; then +if [ "$DISABLE_LOCAL_API" == "true" ] || [ "$DISABLE_LOCAL_API" == "TRUE" ]; then ARGS="$ARGS -no-api" fi if [ "$LEVEL_TRACE" == "true" ] || [ "$LEVEL_TRACE" == "TRUE" ]; then