From e597fde1367d9f047013fbae55173934f333135c Mon Sep 17 00:00:00 2001 From: chaos Date: Sun, 18 Feb 2024 21:20:38 +0000 Subject: [PATCH] remove unneeded grocy patch stuff --- .../containers/grocy/profiles/grocy.nix | 8 +-- overlay/grocy-env-variables.diff | 59 +------------------ scripts/deploy/hetzner-arm.sh | 2 +- scripts/deploy/vault.sh | 2 +- 4 files changed, 5 insertions(+), 66 deletions(-) diff --git a/hosts/hetzner-arm/containers/grocy/profiles/grocy.nix b/hosts/hetzner-arm/containers/grocy/profiles/grocy.nix index 7e7ddf9..925b5d2 100644 --- a/hosts/hetzner-arm/containers/grocy/profiles/grocy.nix +++ b/hosts/hetzner-arm/containers/grocy/profiles/grocy.nix @@ -16,7 +16,7 @@ "pm.min_spare_servers" = 2; "pm.max_spare_servers" = 5; "catch_workers_output" = true; - #"php_flag[display_errors]" = true; + "php_admin_flag[display_errors]" = true; "php_admin_value[error_log]" = "stderr"; "php_admin_flag[log_errors]" = true; }; @@ -32,11 +32,7 @@ in { phpEnv = { GROCY_CONFIG_FILE = "/etc/grocy/config.php"; - GROCY_DB_FILE = "${cfg.dataDir}/grocy.db"; - GROCY_SQL_LOG_FILE = "${cfg.dataDir}/sql.log"; - GROCY_STORAGE_DIR = "${cfg.dataDir}/storage"; - GROCY_PLUGIN_DIR = "${cfg.dataDir}/plugins"; - GROCY_CACHE_DIR = "${cfg.dataDir}/viewcache"; + GROCY_DATAPATH = "${cfg.dataDir}"; }; }; diff --git a/overlay/grocy-env-variables.diff b/overlay/grocy-env-variables.diff index 210e52d..abdc0a5 100644 --- a/overlay/grocy-env-variables.diff +++ b/overlay/grocy-env-variables.diff @@ -11,24 +11,6 @@ index bc5b1b3..26f7687 100644 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/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php index 8e12a5c..37b433d 100644 --- a/helpers/PrerequisiteChecker.php @@ -40,43 +22,4 @@ index 8e12a5c..37b433d 100644 - self::checkForConfigFile(); self::checkForConfigDistFile(); self::checkForComposer(); - self::checkForPhpExtensions(); -diff --git a/services/DatabaseService.php b/services/DatabaseService.php -index ba79a73..e6cf14f 100644 ---- a/services/DatabaseService.php -+++ b/services/DatabaseService.php -@@ -29,7 +29,7 @@ class DatabaseService - - if (GROCY_MODE === 'dev') - { -- $logFilePath = GROCY_DATAPATH . '/sql.log'; -+ $logFilePath = getenv('GROCY_SQL_LOG_FILE');; - if (file_exists($logFilePath)) - { - file_put_contents($logFilePath, $sql . PHP_EOL, FILE_APPEND); -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; + self::checkForPhpExtensions(); \ No newline at end of file diff --git a/scripts/deploy/hetzner-arm.sh b/scripts/deploy/hetzner-arm.sh index 20234c7..e714d7b 100755 --- a/scripts/deploy/hetzner-arm.sh +++ b/scripts/deploy/hetzner-arm.sh @@ -6,4 +6,4 @@ cd $(git rev-parse --show-toplevel) DEFAULT_HOST="root@hetzner-arm.servers.genderfucked.monster" TARGET_HOST=${HOST:-${DEFAULT_HOST}} -nixos-rebuild switch --flake .#hetzner-arm --target-host "$TARGET_HOST" --use-substitutes -s "$@" \ No newline at end of file +nixos-rebuild switch --flake .#hetzner-arm --target-host "$TARGET_HOST" --no-build-nix --fast --use-substitutes -s "$@" \ No newline at end of file diff --git a/scripts/deploy/vault.sh b/scripts/deploy/vault.sh index 3a42abe..4927f21 100755 --- a/scripts/deploy/vault.sh +++ b/scripts/deploy/vault.sh @@ -6,4 +6,4 @@ cd $(git rev-parse --show-toplevel) DEFAULT_HOST="root@vault.servers.genderfucked.monster" TARGET_HOST=${HOST:-${DEFAULT_HOST}} -nixos-rebuild switch --flake .#vault --target-host "$TARGET_HOST" --use-substitutes -s "$@" \ No newline at end of file +nixos-rebuild switch --flake .#vault --target-host "$TARGET_HOST" --no-build-nix --fast --use-substitutes -s "$@" \ No newline at end of file