Browse Source

feat: add mapped kimai configuration file

master
Dennis Buchhorn 2 years ago
parent
commit
1531daff0e
4 changed files with 41 additions and 27 deletions
  1. +5
    -0
      config_examples/disable_registration_and_password_reset.yaml
  2. +5
    -0
      config_examples/session_lifetime_24h.yaml
  3. +2
    -0
      docker-compose.yml
  4. +29
    -27
      setup

+ 5
- 0
config_examples/disable_registration_and_password_reset.yaml View File

@ -0,0 +1,5 @@
kimai:
user:
registration: false
password_reset: false

+ 5
- 0
config_examples/session_lifetime_24h.yaml View File

@ -0,0 +1,5 @@
framework:
session:
gc_maxlifetime: 86400
cookie_lifetime: 86400

+ 2
- 0
docker-compose.yml View File

@ -6,6 +6,8 @@ services:
restart: unless-stopped restart: unless-stopped
ports: ports:
- ${KIMAI_HOST_IP_ADDRESS:-127.0.0.1}:${KIMAI_HOST_PORT:-8001}:8001 - ${KIMAI_HOST_IP_ADDRESS:-127.0.0.1}:${KIMAI_HOST_PORT:-8001}:8001
volumes:
- ./config/local.yaml:/opt/kimai/config/packages/local.yaml:ro
environment: environment:
ADMINMAIL: ${KIMAI_SUPERADMIN_MAIL:-admin@kimai.local} ADMINMAIL: ${KIMAI_SUPERADMIN_MAIL:-admin@kimai.local}
ADMINPASS: ${KIMAI_SUPERADMIN_PASSWORD:-password} ADMINPASS: ${KIMAI_SUPERADMIN_PASSWORD:-password}


+ 29
- 27
setup View File

@ -33,7 +33,10 @@ KIMAI_DB_NAME=""
KIMAI_DB_USER="" KIMAI_DB_USER=""
KIMAI_DB_PASSWORD="" KIMAI_DB_PASSWORD=""
KIMAI_CONFIG_EXISTS="false"
USE_EXISTING_KIMAI_CONFIG=""
DISABLE_REGISTRATION="" DISABLE_REGISTRATION=""
SESSION_LIFETIME_TO_24H=""
read -p "Enter kimai project name suffix (leave empty for none): " KIMAI_PROJECT_NAME_SUFFIX read -p "Enter kimai project name suffix (leave empty for none): " KIMAI_PROJECT_NAME_SUFFIX
@ -89,7 +92,32 @@ cat "config" >> ".env"
read -p "Should the config file 'config' be deleted after creating the container? (y/n)" DELETE_CONFIG read -p "Should the config file 'config' be deleted after creating the container? (y/n)" DELETE_CONFIG
read -p "Would you like to disable user registration and password reset via mail? (y/n)" DISABLE_REGISTRATION
if [ -f "config/local.yaml" ]; then
KIMAI_CONFIG_EXISTS="true"
read -p "Kimai config file 'config/local.yaml' already exists! Would you like to use this? (y/n)" USE_EXISTING_KIMAI_CONFIG
fi
if [ $KIMAI_CONFIG_EXISTS == "false" ] || [ $USE_EXISTING_KIMAI_CONFIG == "n" ]; then
echo "Create blank kimai config file 'config/local.yaml'!"
rm -rf touch config/local.yaml
mkdir -p config
touch config/local.yaml
read -p "Would you like to disable user registration and password reset via mail? (y/n)" DISABLE_REGISTRATION
read -p "Would you like to set the session lifetime to 24h? (y/n)" SESSION_LIFETIME_TO_24H
if [ $DISABLE_REGISTRATION == "y" ]; then
cat "config_examples/disable_registration_and_password_reset.yaml" >> "config/local.yaml"
fi
if [ $SESSION_LIFETIME_TO_24H == "y" ]; then
cat "config_examples/session_lifetime_24h.yaml" >> "config/local.yaml"
fi
else
echo "Use existing kimai config file 'config/local.yaml'!"
fi
docker-compose up -d docker-compose up -d
@ -102,32 +130,6 @@ done
echo -e "\nKimai is ready!" echo -e "\nKimai is ready!"
if [ $DISABLE_REGISTRATION == "y" ]; then
echo "Create 'local.yaml' file and restart container."
rm -f tmp
touch tmp
echo "kimai:" >> tmp
echo " user:" >> tmp
echo " registration: false" >> tmp
echo " password_reset: false" >> tmp
docker exec -i $KIMAI_CONTAINER_NAME dd of=/opt/kimai/config/packages/local.yaml < tmp >> /dev/null 2>&1
rm -f tmp
docker restart -t 0 $KIMAI_CONTAINER_NAME >> /dev/null
echo -n "Wait until kimai is ready ..."
while [ "`docker inspect -f {{.State.Health.Status}} $KIMAI_CONTAINER_NAME`" != "healthy" ]; do
echo -n "."
sleep 1
done
echo -e "\nKimai is ready!"
fi
if [ $DELETE_CONFIG == "y" ]; then if [ $DELETE_CONFIG == "y" ]; then
rm -f config rm -f config


Loading…
Cancel
Save