2020-12-22 15:00:33 +00:00
|
|
|
From 7ed6c641cc501246931721700b73f40dce7e8f4b Mon Sep 17 00:00:00 2001
|
2020-03-06 22:46:07 +00:00
|
|
|
From: Maximilian Bosch <maximilian@mbosch.me>
|
2020-12-22 15:00:33 +00:00
|
|
|
Date: Tue, 22 Dec 2020 15:38:56 +0100
|
2020-04-16 17:24:51 +00:00
|
|
|
Subject: [PATCH 1/2] Define configs with env vars
|
2020-03-06 22:46:07 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
app.php | 4 ++--
|
|
|
|
services/DatabaseService.php | 2 +-
|
|
|
|
services/FilesService.php | 2 +-
|
2020-12-22 15:00:33 +00:00
|
|
|
services/StockService.php | 3 +--
|
|
|
|
4 files changed, 5 insertions(+), 6 deletions(-)
|
2020-03-06 22:46:07 +00:00
|
|
|
|
|
|
|
diff --git a/app.php b/app.php
|
2020-12-22 15:00:33 +00:00
|
|
|
index 8176ebe..04432ba 100644
|
2020-03-06 22:46:07 +00:00
|
|
|
--- a/app.php
|
|
|
|
+++ b/app.php
|
2020-12-22 15:00:33 +00:00
|
|
|
@@ -10,7 +10,7 @@ use Slim\Factory\AppFactory;
|
2020-02-07 15:34:48 +00:00
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
|
|
|
|
// Load config files
|
|
|
|
-require_once GROCY_DATAPATH . '/config.php';
|
|
|
|
+require_once getenv('GROCY_CONFIG_FILE');
|
|
|
|
require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones
|
|
|
|
|
|
|
|
// Definitions for dev/demo/prerelease mode
|
2020-12-22 15:00:33 +00:00
|
|
|
@@ -37,7 +37,7 @@ $app = AppFactory::create();
|
|
|
|
|
2020-03-06 22:46:07 +00:00
|
|
|
$container = $app->getContainer();
|
2020-12-22 15:00:33 +00:00
|
|
|
$container->set('view', function (Container $container) {
|
2020-03-06 22:46:07 +00:00
|
|
|
- return new Slim\Views\Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
|
2020-12-22 15:00:33 +00:00
|
|
|
+ return new Slim\Views\Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR'));
|
2020-03-06 22:46:07 +00:00
|
|
|
});
|
2020-12-22 15:00:33 +00:00
|
|
|
$container->set('UrlManager', function (Container $container) {
|
|
|
|
return new UrlManager(GROCY_BASE_URL);
|
2020-03-06 22:46:07 +00:00
|
|
|
diff --git a/services/DatabaseService.php b/services/DatabaseService.php
|
2020-12-22 15:00:33 +00:00
|
|
|
index d1080b0..8bc4ee1 100644
|
2020-03-06 22:46:07 +00:00
|
|
|
--- a/services/DatabaseService.php
|
|
|
|
+++ b/services/DatabaseService.php
|
2020-12-22 15:00:33 +00:00
|
|
|
@@ -105,6 +105,6 @@ class DatabaseService
|
|
|
|
return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db';
|
2020-02-07 15:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- return GROCY_DATAPATH . '/grocy.db';
|
|
|
|
+ return getenv('GROCY_DB_FILE');
|
|
|
|
}
|
2020-12-22 15:00:33 +00:00
|
|
|
}
|
2020-03-06 22:46:07 +00:00
|
|
|
diff --git a/services/FilesService.php b/services/FilesService.php
|
2020-12-22 15:00:33 +00:00
|
|
|
index 8c1483e..8f74b4b 100644
|
2020-03-06 22:46:07 +00:00
|
|
|
--- a/services/FilesService.php
|
|
|
|
+++ b/services/FilesService.php
|
2020-12-22 15:00:33 +00:00
|
|
|
@@ -70,7 +70,7 @@ class FilesService extends BaseService
|
2020-02-07 15:34:48 +00:00
|
|
|
{
|
|
|
|
parent::__construct();
|
2020-03-06 22:46:07 +00:00
|
|
|
|
2020-02-07 15:34:48 +00:00
|
|
|
- $this->StoragePath = GROCY_DATAPATH . '/storage';
|
|
|
|
+ $this->StoragePath = getenv('GROCY_STORAGE_DIR');
|
2020-03-06 22:46:07 +00:00
|
|
|
|
2020-02-07 15:34:48 +00:00
|
|
|
if (!file_exists($this->StoragePath))
|
|
|
|
{
|
2020-03-06 22:46:07 +00:00
|
|
|
diff --git a/services/StockService.php b/services/StockService.php
|
2020-12-22 15:00:33 +00:00
|
|
|
index 4741b4b..6d4e748 100644
|
2020-03-06 22:46:07 +00:00
|
|
|
--- a/services/StockService.php
|
|
|
|
+++ b/services/StockService.php
|
2020-12-22 15:00:33 +00:00
|
|
|
@@ -1374,8 +1374,7 @@ class StockService extends BaseService
|
2020-02-07 15:34:48 +00:00
|
|
|
throw new \Exception('No barcode lookup plugin defined');
|
|
|
|
}
|
|
|
|
|
|
|
|
- $path = GROCY_DATAPATH . "/plugins/$pluginName.php";
|
2020-12-22 15:00:33 +00:00
|
|
|
-
|
|
|
|
+ $path = getenv('GROCY_PLUGIN_DIR') . "/$pluginName.php";
|
2020-02-07 15:34:48 +00:00
|
|
|
if (file_exists($path))
|
|
|
|
{
|
|
|
|
require_once $path;
|
2020-03-06 22:46:07 +00:00
|
|
|
--
|
2020-12-22 15:00:33 +00:00
|
|
|
2.29.2
|
2020-03-06 22:46:07 +00:00
|
|
|
|