From cccb748d44d77405f4627d2af235273067069a22 Mon Sep 17 00:00:00 2001 From: Saru Date: Fri, 24 Jul 2026 14:23:44 +0200 Subject: [PATCH] fix: populate missing config files when only part of /etc/crowdsec is mounted --- build/docker/docker_start.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/build/docker/docker_start.sh b/build/docker/docker_start.sh index 04eb2535015..0cd15346de3 100755 --- a/build/docker/docker_start.sh +++ b/build/docker/docker_start.sh @@ -319,16 +319,14 @@ for target in "/staging/var/lib/crowdsec/data"/*; do done # Check and prestage /etc/crowdsec -if [ ! -e "/etc/crowdsec/local_api_credentials.yaml" ] && [ ! -e "/etc/crowdsec/config.yaml" ]; then - echo "Populating configuration directory..." - # don't overwrite existing configuration files, which may come - # from bind-mount or even be read-only (configmaps) - if [ -e /staging/etc/crowdsec ]; then - mkdir -p /etc/crowdsec/ - # if you change this, check that it still works - # under alpine and k8s, with and without tls - rsync -av --ignore-existing /staging/etc/crowdsec/* /etc/crowdsec - fi +# don't overwrite existing configuration files, which may come +# from bind-mount or even be read-only (configmaps) +if [ -e /staging/etc/crowdsec ]; then + echo "Populating missing config files..." + mkdir -p /etc/crowdsec/ + # if you change this, check that it still works + # under alpine and k8s, with and without tls + rsync -av --ignore-existing /staging/etc/crowdsec/* /etc/crowdsec fi # do this as soon as we have a config.yaml, to avoid useless warnings