From 28b36706965b694807cb4e563f759bb4b8dbbd26 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 21 Jul 2018 09:20:47 -0600 Subject: [PATCH] Override the database path in Docker containers --- Dockerfile | 3 +++ src/db/DimensionStore.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f2d72f3..a2ab0d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,9 @@ USER node VOLUME ["/data"] +# Ensure the database doesn't get lost to the container +ENV DIMENSION_DB_PATH=/data/dimension.db + EXPOSE 8184 #CMD ["/bin/sh"] ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/src/db/DimensionStore.ts b/src/db/DimensionStore.ts index eb55920..0ca67fe 100644 --- a/src/db/DimensionStore.ts +++ b/src/db/DimensionStore.ts @@ -29,7 +29,7 @@ class _DimensionStore { this.sequelize = new Sequelize({ dialect: 'sqlite', database: "dimension", - storage: config.database.file, + storage: process.env['DIMENSION_DB_PATH'] || config.database.file, username: "", password: "", logging: i => LogService.verbose("DimensionStore [SQL]", i)