Unverified Commit 7f17a67c authored by Casey Link's avatar Casey Link
Browse files

davis: 4.4.1 -> 4.4.2

Release notes: https://github.com/tchapi/davis/releases/tag/v4.4.2

Removed composer.lock from nixpkgs tree because upstream contains it.
parent 85f22fec
Loading
Loading
Loading
Loading
+0 −10650

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −78
Original line number Diff line number Diff line
diff --git a/bin/console b/bin/console
index 8fe9d49..3af9662 100755
--- a/bin/console
+++ b/bin/console
@@ -1,5 +1,8 @@
 #!/usr/bin/env php
 <?php
+if (getenv('ENV_DIR') !== false) {
+    $_SERVER['APP_RUNTIME_OPTIONS']['dotenv_path'] = getenv('ENV_DIR').'/.env';
+}
 
 use App\Kernel;
 use Symfony\Bundle\FrameworkBundle\Console\Application;
@@ -28,7 +31,11 @@ if ($input->hasParameterOption('--no-debug', true)) {
     putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
 }
 
-(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
+if (getenv('ENV_DIR') !== false) {
+    (new Dotenv())->bootEnv(getenv('ENV_DIR').'/.env');
+} else {
+    (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
+}
 
 if ($_SERVER['APP_DEBUG']) {
     umask(0000);
diff --git a/public/index.php b/public/index.php
index 3f8b90e..c57ec21 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,5 +1,9 @@
 <?php
 
+if (getenv('ENV_DIR') !== false) {
+    $_SERVER['APP_RUNTIME_OPTIONS']['dotenv_path'] = getenv('ENV_DIR').'/.env';
+}
+
 use App\Kernel;
 use Symfony\Component\Dotenv\Dotenv;
 use Symfony\Component\ErrorHandler\Debug;
@@ -7,7 +11,11 @@ use Symfony\Component\HttpFoundation\Request;
 
 require dirname(__DIR__).'/vendor/autoload.php';
 
-(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
+if (getenv('ENV_DIR') !== false) {
+    (new Dotenv())->bootEnv(getenv('ENV_DIR').'/.env');
+} else {
+    (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
+}
 
 if ($_SERVER['APP_DEBUG']) {
     umask(0000);
diff --git a/src/Kernel.php b/src/Kernel.php
index 0f43d2f..8863f2c 100644
--- a/src/Kernel.php
+++ b/src/Kernel.php
@@ -49,4 +49,20 @@ class Kernel extends BaseKernel
             (require $path)($routes->withPath($path), $this);
         }
     }
+
+    public function getCacheDir(): string
+    {
+        if (getenv('CACHE_DIR') !== false) {
+            return getenv('CACHE_DIR') . '/' . $this->getEnvironment();
+        }
+        return parent::getCacheDir();
+    }
+
+    public function getLogDir(): string
+    {
+        if (getenv('LOG_DIR') !== false) {
+            return getenv('LOG_DIR') . '/' . $this->getEnvironment();
+        }
+        return parent::getLogDir();
+    }
 }
+8 −14
Original line number Diff line number Diff line
{ lib, fetchFromGitHub, php, }:
{
  lib,
  fetchFromGitHub,
  php,
}:

php.buildComposerProject (finalAttrs: {
  pname = "davis";
  version = "4.4.1";
  version = "4.4.2";

  src = fetchFromGitHub {
    owner = "tchapi";
    repo = "davis";
    rev = "v${finalAttrs.version}";
    hash = "sha256-UBekmxKs4dveHh866Ix8UzY2NL6ygb8CKor+V3Cblns=";
    hash = "sha256-oPzMBCOcAJoHni9SO74RuJDEOcVYc4MtO5rGq1E9g3Q=";
  };

  composerLock = ./composer.lock;
  vendorHash = "sha256-WGeNwBRzfUXa7kPIwd7/5dPXDjaBxXirAJcm6lNzueY=";

  patches = [
    # Symfony loads .env files from the same directory as composer.json
    # The .env files contain runtime configuration that shouldn't be baked into deriviation for the package
    # This patch adds a few extension points exposing three environment variables:
    #    RUNTIME_DIRECTORY (where to load .env from), CACHE_DIRECTORY and LOG_DIRECTORY (symfony cache and log rw directories)
    # Upstream PR https://github.com/tchapi/davis/issues/154
    ./davis-data.patch
  ];
  vendorHash = "sha256-NOb6rc9jVsf+/RVOW7SLBAJk9SihcRxoepUEGBGLi2w=";

  postInstall = ''
    # Only include the files needed for runtime in the derivation