|
1 |
| -From 231ee836e357b83cc2fc0a3a977f74839308ec68 Mon Sep 17 00:00:00 2001 |
2 |
| -From: Ember Keske <git@n0emis.eu> |
3 |
| -Date: Wed, 2 Aug 2023 06:36:02 +0200 |
4 |
| -Subject: [PATCH 1/2] Define configs with env vars |
5 |
| - |
6 |
| ---- |
7 |
| - app.php | 6 +++--- |
8 |
| - services/DatabaseService.php | 2 +- |
9 |
| - services/FilesService.php | 2 +- |
10 |
| - services/StockService.php | 2 +- |
11 |
| - 4 files changed, 6 insertions(+), 6 deletions(-) |
12 |
| - |
13 |
| -diff --git a/app.php b/app.php |
14 |
| -index bc5b1b39..26f7687e 100644 |
15 |
| ---- a/app.php |
16 |
| -+++ b/app.php |
17 |
| -@@ -12,7 +12,7 @@ use Slim\Views\Blade; |
18 |
| - require_once __DIR__ . '/packages/autoload.php'; |
19 |
| - |
20 |
| - // Load config files |
21 |
| --require_once GROCY_DATAPATH . '/config.php'; |
22 |
| -+require_once getenv('GROCY_CONFIG_FILE'); |
23 |
| - require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones |
24 |
| - require_once __DIR__ . '/helpers/ConfigurationValidator.php'; |
25 |
| - |
26 |
| -@@ -64,7 +64,7 @@ $app = AppFactory::create(); |
27 |
| - $container = $app->getContainer(); |
28 |
| - $container->set('view', function (Container $container) |
29 |
| - { |
30 |
| -- return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'); |
31 |
| -+ return new Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR')); |
32 |
| - }); |
33 |
| - |
34 |
| - $container->set('UrlManager', function (Container $container) |
35 |
| -@@ -106,7 +106,7 @@ $errorMiddleware->setDefaultErrorHandler( |
36 |
| - |
37 |
| - $app->add(new CorsMiddleware($app->getResponseFactory())); |
38 |
| - |
39 |
| --$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php'); |
40 |
| -+$app->getRouteCollector()->setCacheFile(getenv('GROCY_CACHE_DIR') . '/route_cache.php'); |
41 |
| - |
42 |
| - ob_clean(); // No response output before here |
43 |
| - $app->run(); |
44 |
| -diff --git a/services/DatabaseService.php b/services/DatabaseService.php |
45 |
| -index 4a05bda1..ce41ed17 100644 |
46 |
| ---- a/services/DatabaseService.php |
47 |
| -+++ b/services/DatabaseService.php |
48 |
| -@@ -125,6 +125,6 @@ class DatabaseService |
49 |
| - return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db'; |
50 |
| - } |
51 |
| - |
52 |
| -- return GROCY_DATAPATH . '/grocy.db'; |
53 |
| -+ return getenv('GROCY_DB_FILE'); |
54 |
| - } |
55 |
| - } |
56 |
| -diff --git a/services/FilesService.php b/services/FilesService.php |
57 |
| -index 7d070350..a6dd4b08 100644 |
58 |
| ---- a/services/FilesService.php |
59 |
| -+++ b/services/FilesService.php |
60 |
| -@@ -10,7 +10,7 @@ class FilesService extends BaseService |
61 |
| - |
62 |
| - public function __construct() |
63 |
| - { |
64 |
| -- $this->StoragePath = GROCY_DATAPATH . '/storage'; |
65 |
| -+ $this->StoragePath = getenv('GROCY_STORAGE_DIR'); |
66 |
| - if (!file_exists($this->StoragePath)) |
67 |
| - { |
68 |
| - mkdir($this->StoragePath); |
69 |
| -diff --git a/services/StockService.php b/services/StockService.php |
70 |
| -index 7265e82b..13af591a 100644 |
71 |
| ---- a/services/StockService.php |
72 |
| -+++ b/services/StockService.php |
73 |
| -@@ -1761,7 +1761,7 @@ class StockService extends BaseService |
74 |
| - throw new \Exception('No barcode lookup plugin defined'); |
75 |
| - } |
76 |
| - |
77 |
| -- $path = GROCY_DATAPATH . "/plugins/$pluginName.php"; |
78 |
| -+ $path = getenv('GROCY_PLUGIN_DIR') . "/$pluginName.php"; |
79 |
| - |
80 |
| - if (file_exists($path)) |
81 |
| - { |
82 |
| --- |
83 |
| -2.41.0 |
84 |
| - |
| 1 | +From 231ee836e357b83cc2fc0a3a977f74839308ec68 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Ember Keske <git@n0emis.eu> |
| 3 | +Date: Wed, 2 Aug 2023 06:36:02 +0200 |
| 4 | +Subject: [PATCH 1/2] Define configs with env vars |
| 5 | + |
| 6 | +--- |
| 7 | + app.php | 6 +++--- |
| 8 | + services/DatabaseService.php | 2 +- |
| 9 | + services/FilesService.php | 2 +- |
| 10 | + services/StockService.php | 2 +- |
| 11 | + 4 files changed, 6 insertions(+), 6 deletions(-) |
| 12 | + |
| 13 | +diff --git a/app.php b/app.php |
| 14 | +index bc5b1b3..26f7687 100644 |
| 15 | +--- a/app.php |
| 16 | ++++ b/app.php |
| 17 | +@@ -12,7 +12,7 @@ use Slim\Views\Blade; |
| 18 | + require_once __DIR__ . '/packages/autoload.php'; |
| 19 | + |
| 20 | + // Load config files |
| 21 | +-require_once GROCY_DATAPATH . '/config.php'; |
| 22 | ++require_once getenv('GROCY_CONFIG_FILE'); |
| 23 | + require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones |
| 24 | + require_once __DIR__ . '/helpers/ConfigurationValidator.php'; |
| 25 | + |
| 26 | +@@ -64,7 +64,7 @@ $app = AppFactory::create(); |
| 27 | + $container = $app->getContainer(); |
| 28 | + $container->set('view', function (Container $container) |
| 29 | + { |
| 30 | +- return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache'); |
| 31 | ++ return new Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR')); |
| 32 | + }); |
| 33 | + |
| 34 | + $container->set('UrlManager', function (Container $container) |
| 35 | +@@ -106,7 +106,7 @@ $errorMiddleware->setDefaultErrorHandler( |
| 36 | + |
| 37 | + $app->add(new CorsMiddleware($app->getResponseFactory())); |
| 38 | + |
| 39 | +-$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php'); |
| 40 | ++$app->getRouteCollector()->setCacheFile(getenv('GROCY_CACHE_DIR') . '/route_cache.php'); |
| 41 | + |
| 42 | + ob_clean(); // No response output before here |
| 43 | + $app->run(); |
| 44 | +diff --git a/services/DatabaseService.php b/services/DatabaseService.php |
| 45 | +index ba79a73..12a851a 100644 |
| 46 | +--- a/services/DatabaseService.php |
| 47 | ++++ b/services/DatabaseService.php |
| 48 | +@@ -137,6 +137,6 @@ class DatabaseService |
| 49 | + return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db'; |
| 50 | + } |
| 51 | + |
| 52 | +- return GROCY_DATAPATH . '/grocy.db'; |
| 53 | ++ return getenv('GROCY_DB_FILE'); |
| 54 | + } |
| 55 | + } |
| 56 | +diff --git a/services/FilesService.php b/services/FilesService.php |
| 57 | +index 7d07035..a6dd4b0 100644 |
| 58 | +--- a/services/FilesService.php |
| 59 | ++++ b/services/FilesService.php |
| 60 | +@@ -10,7 +10,7 @@ class FilesService extends BaseService |
| 61 | + |
| 62 | + public function __construct() |
| 63 | + { |
| 64 | +- $this->StoragePath = GROCY_DATAPATH . '/storage'; |
| 65 | ++ $this->StoragePath = getenv('GROCY_STORAGE_DIR'); |
| 66 | + if (!file_exists($this->StoragePath)) |
| 67 | + { |
| 68 | + mkdir($this->StoragePath); |
| 69 | +diff --git a/services/StockService.php b/services/StockService.php |
| 70 | +index 9f034a5..fd3c0b7 100644 |
| 71 | +--- a/services/StockService.php |
| 72 | ++++ b/services/StockService.php |
| 73 | +@@ -1707,7 +1707,7 @@ class StockService extends BaseService |
| 74 | + throw new \Exception('No barcode lookup plugin defined'); |
| 75 | + } |
| 76 | + |
| 77 | +- $path = GROCY_DATAPATH . "/plugins/$pluginName.php"; |
| 78 | ++ $path = getenv('GROCY_PLUGIN_DIR') . "/$pluginName.php"; |
| 79 | + if (file_exists($path)) |
| 80 | + { |
| 81 | + require_once $path; |
| 82 | +-- |
| 83 | +2.42.0 |
| 84 | + |
0 commit comments