Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grocy: 4.0.3 -> 4.1.0 #288602

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 84 additions & 84 deletions pkgs/servers/grocy/0001-Define-configs-with-env-vars.patch
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
From 231ee836e357b83cc2fc0a3a977f74839308ec68 Mon Sep 17 00:00:00 2001
From: Ember Keske <git@n0emis.eu>
Date: Wed, 2 Aug 2023 06:36:02 +0200
Subject: [PATCH 1/2] Define configs with env vars
---
app.php | 6 +++---
services/DatabaseService.php | 2 +-
services/FilesService.php | 2 +-
services/StockService.php | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app.php b/app.php
index bc5b1b39..26f7687e 100644
--- a/app.php
+++ b/app.php
@@ -12,7 +12,7 @@ use Slim\Views\Blade;
require_once __DIR__ . '/packages/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';
@@ -64,7 +64,7 @@ $app = AppFactory::create();
$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'));
});
$container->set('UrlManager', function (Container $container)
@@ -106,7 +106,7 @@ $errorMiddleware->setDefaultErrorHandler(
$app->add(new CorsMiddleware($app->getResponseFactory()));
-$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php');
+$app->getRouteCollector()->setCacheFile(getenv('GROCY_CACHE_DIR') . '/route_cache.php');
ob_clean(); // No response output before here
$app->run();
diff --git a/services/DatabaseService.php b/services/DatabaseService.php
index 4a05bda1..ce41ed17 100644
--- a/services/DatabaseService.php
+++ b/services/DatabaseService.php
@@ -125,6 +125,6 @@ class DatabaseService
return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db';
}
- return GROCY_DATAPATH . '/grocy.db';
+ return getenv('GROCY_DB_FILE');
}
}
diff --git a/services/FilesService.php b/services/FilesService.php
index 7d070350..a6dd4b08 100644
--- a/services/FilesService.php
+++ b/services/FilesService.php
@@ -10,7 +10,7 @@ class FilesService extends BaseService
public function __construct()
{
- $this->StoragePath = GROCY_DATAPATH . '/storage';
+ $this->StoragePath = getenv('GROCY_STORAGE_DIR');
if (!file_exists($this->StoragePath))
{
mkdir($this->StoragePath);
diff --git a/services/StockService.php b/services/StockService.php
index 7265e82b..13af591a 100644
--- a/services/StockService.php
+++ b/services/StockService.php
@@ -1761,7 +1761,7 @@ class StockService extends BaseService
throw new \Exception('No barcode lookup plugin defined');
}
- $path = GROCY_DATAPATH . "/plugins/$pluginName.php";
+ $path = getenv('GROCY_PLUGIN_DIR') . "/$pluginName.php";
if (file_exists($path))
{
--
2.41.0
From 231ee836e357b83cc2fc0a3a977f74839308ec68 Mon Sep 17 00:00:00 2001
From: Ember Keske <git@n0emis.eu>
Date: Wed, 2 Aug 2023 06:36:02 +0200
Subject: [PATCH 1/2] Define configs with env vars

---
app.php | 6 +++---
services/DatabaseService.php | 2 +-
services/FilesService.php | 2 +-
services/StockService.php | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/app.php b/app.php
index bc5b1b3..26f7687 100644
--- a/app.php
+++ b/app.php
@@ -12,7 +12,7 @@ use Slim\Views\Blade;
require_once __DIR__ . '/packages/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';

@@ -64,7 +64,7 @@ $app = AppFactory::create();
$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'));
});

$container->set('UrlManager', function (Container $container)
@@ -106,7 +106,7 @@ $errorMiddleware->setDefaultErrorHandler(

$app->add(new CorsMiddleware($app->getResponseFactory()));

-$app->getRouteCollector()->setCacheFile(GROCY_DATAPATH . '/viewcache/route_cache.php');
+$app->getRouteCollector()->setCacheFile(getenv('GROCY_CACHE_DIR') . '/route_cache.php');

ob_clean(); // No response output before here
$app->run();
diff --git a/services/DatabaseService.php b/services/DatabaseService.php
index ba79a73..12a851a 100644
--- a/services/DatabaseService.php
+++ b/services/DatabaseService.php
@@ -137,6 +137,6 @@ class DatabaseService
return GROCY_DATAPATH . '/grocy_' . $dbSuffix . '.db';
}

- return GROCY_DATAPATH . '/grocy.db';
+ return getenv('GROCY_DB_FILE');
}
}
diff --git a/services/FilesService.php b/services/FilesService.php
index 7d07035..a6dd4b0 100644
--- a/services/FilesService.php
+++ b/services/FilesService.php
@@ -10,7 +10,7 @@ class FilesService extends BaseService

public function __construct()
{
- $this->StoragePath = GROCY_DATAPATH . '/storage';
+ $this->StoragePath = getenv('GROCY_STORAGE_DIR');
if (!file_exists($this->StoragePath))
{
mkdir($this->StoragePath);
diff --git a/services/StockService.php b/services/StockService.php
index 9f034a5..fd3c0b7 100644
--- a/services/StockService.php
+++ b/services/StockService.php
@@ -1707,7 +1707,7 @@ class StockService extends BaseService
throw new \Exception('No barcode lookup plugin defined');
}

- $path = GROCY_DATAPATH . "/plugins/$pluginName.php";
+ $path = getenv('GROCY_PLUGIN_DIR') . "/$pluginName.php";
if (file_exists($path))
{
require_once $path;
--
2.42.0

Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
From b532add2d1287489d4541e79c976bb77795696cd Mon Sep 17 00:00:00 2001
From: Ember Keske <git@n0emis.eu>
Date: Wed, 2 Aug 2023 06:36:46 +0200
Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy
---
helpers/PrerequisiteChecker.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php
index da431b4b..6b878627 100644
--- a/helpers/PrerequisiteChecker.php
+++ b/helpers/PrerequisiteChecker.php
@@ -17,7 +17,6 @@ class PrerequisiteChecker
public function checkRequirements()
{
self::checkForPhpVersion();
- self::checkForConfigFile();
self::checkForConfigDistFile();
self::checkForComposer();
self::checkForPhpExtensions();
--
2.41.0
From b532add2d1287489d4541e79c976bb77795696cd Mon Sep 17 00:00:00 2001
From: Ember Keske <git@n0emis.eu>
Date: Wed, 2 Aug 2023 06:36:46 +0200
Subject: [PATCH 2/2] Remove check for config-file as it's stored in /etc/grocy

---
helpers/PrerequisiteChecker.php | 1 -
1 file changed, 1 deletion(-)

diff --git a/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php
index 8e12a5c..37b433d 100644
--- a/helpers/PrerequisiteChecker.php
+++ b/helpers/PrerequisiteChecker.php
@@ -18,7 +18,6 @@ class PrerequisiteChecker
public function checkRequirements()
{
self::checkForPhpVersion();
- self::checkForConfigFile();
self::checkForConfigDistFile();
self::checkForComposer();
self::checkForPhpExtensions();
--
2.42.0

6 changes: 3 additions & 3 deletions pkgs/servers/grocy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

stdenv.mkDerivation rec {
pname = "grocy";
version = "4.0.3";
version = "4.1.0";

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

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

dontBuild = true;

Expand Down
Loading