Skip to content

Commit d089d27

Browse files
committed
grocy: 4.0.3 -> 4.1.0
1 parent f9d39fb commit d089d27

3 files changed

+111
-111
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,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 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+
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
From b532add2d1287489d4541e79c976bb77795696cd Mon Sep 17 00:00:00 2001
2-
From: Ember Keske <git@n0emis.eu>
3-
Date: Wed, 2 Aug 2023 06:36:46 +0200
4-
Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy
5-
6-
---
7-
helpers/PrerequisiteChecker.php | 1 -
8-
1 file changed, 1 deletion(-)
9-
10-
diff --git a/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php
11-
index da431b4b..6b878627 100644
12-
--- a/helpers/PrerequisiteChecker.php
13-
+++ b/helpers/PrerequisiteChecker.php
14-
@@ -17,7 +17,6 @@ class PrerequisiteChecker
15-
public function checkRequirements()
16-
{
17-
self::checkForPhpVersion();
18-
- self::checkForConfigFile();
19-
self::checkForConfigDistFile();
20-
self::checkForComposer();
21-
self::checkForPhpExtensions();
22-
--
23-
2.41.0
24-
1+
From b532add2d1287489d4541e79c976bb77795696cd Mon Sep 17 00:00:00 2001
2+
From: Ember Keske <git@n0emis.eu>
3+
Date: Wed, 2 Aug 2023 06:36:46 +0200
4+
Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy
5+
6+
---
7+
helpers/PrerequisiteChecker.php | 1 -
8+
1 file changed, 1 deletion(-)
9+
10+
diff --git a/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php
11+
index 8e12a5c..37b433d 100644
12+
--- a/helpers/PrerequisiteChecker.php
13+
+++ b/helpers/PrerequisiteChecker.php
14+
@@ -18,7 +18,6 @@ class PrerequisiteChecker
15+
public function checkRequirements()
16+
{
17+
self::checkForPhpVersion();
18+
- self::checkForConfigFile();
19+
self::checkForConfigDistFile();
20+
self::checkForComposer();
21+
self::checkForPhpExtensions();
22+
--
23+
2.42.0
24+

pkgs/servers/grocy/default.nix

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
stdenv.mkDerivation rec {
44
pname = "grocy";
5-
version = "4.0.3";
5+
version = "4.1.0";
66

77
src = fetchurl {
88
url = "https://github.com/grocy/grocy/releases/download/v${version}/grocy_${version}.zip";
9-
hash = "sha256-KBTsi634SolgA01eRthMuWx7DIF7rhvJSPxiHyuKSR8=";
9+
hash = "sha256-Y4rHFgPmFHcNrETlvMLXSr0v07p2GzfjJ1JjH2YGXoU=";
1010
};
1111

1212
nativeBuildInputs = [ unzip ];
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
2020
./0001-Define-configs-with-env-vars.patch
2121
./0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch
2222
];
23-
patchFlags = [ "--binary" "-p1" ];
23+
patchFlags = [ "--binary" "-p1" "-l" ];
2424

2525
dontBuild = true;
2626

0 commit comments

Comments
 (0)