nixpkgs/pkgs/servers/grocy/0001-Define-configs-with-env-vars.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
2.5 KiB
Diff
Raw Normal View History

From 05b762c6ca58ecb5fd631a019fbda69b0647785f Mon Sep 17 00:00:00 2001
2020-03-06 22:46:07 +00:00
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Tue, 22 Dec 2020 15:38:56 +0100
Subject: [PATCH] Define configs with env vars
2020-03-06 22:46:07 +00:00
---
app.php | 4 ++--
services/DatabaseService.php | 2 +-
services/FilesService.php | 2 +-
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
index 17ba6a99..89f48089 100644
2020-03-06 22:46:07 +00:00
--- a/app.php
+++ b/app.php
@@ -11,7 +11,7 @@ use Slim\Views\Blade;
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
require_once __DIR__ . '/helpers/ConfigurationValidator.php';
2020-02-07 15:34:48 +00:00
@@ -62,7 +62,7 @@ $app = AppFactory::create();
2020-03-06 22:46:07 +00:00
$container = $app->getContainer();
$container->set('view', function (Container $container) {
- return new Blade(__DIR__ . '/views', GROCY_DATAPATH . '/viewcache');
+ return new Blade(__DIR__ . '/views', getenv('GROCY_CACHE_DIR'));
2020-03-06 22:46:07 +00:00
});
$container->set('UrlManager', function (Container $container) {
2020-03-06 22:46:07 +00:00
diff --git a/services/DatabaseService.php b/services/DatabaseService.php
index c093f361..0894791f 100644
2020-03-06 22:46:07 +00:00
--- a/services/DatabaseService.php
+++ b/services/DatabaseService.php
@@ -114,6 +114,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-03-06 22:46:07 +00:00
diff --git a/services/FilesService.php b/services/FilesService.php
index 7d070350..a6dd4b08 100644
2020-03-06 22:46:07 +00:00
--- a/services/FilesService.php
+++ b/services/FilesService.php
@@ -10,7 +10,7 @@ class FilesService extends BaseService
2020-03-06 22:46:07 +00:00
public function __construct()
{
- $this->StoragePath = GROCY_DATAPATH . '/storage';
2020-02-07 15:34:48 +00:00
+ $this->StoragePath = getenv('GROCY_STORAGE_DIR');
if (!file_exists($this->StoragePath))
2020-02-07 15:34:48 +00:00
{
mkdir($this->StoragePath);
2020-03-06 22:46:07 +00:00
diff --git a/services/StockService.php b/services/StockService.php
index 85f57803..15556112 100644
2020-03-06 22:46:07 +00:00
--- a/services/StockService.php
+++ b/services/StockService.php
@@ -1704,8 +1704,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";
-
+ $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
--
2.38.1
2020-03-06 22:46:07 +00:00