From c3f59c18f9cfdeb5067616a49b5f9e8ada10f470 Mon Sep 17 00:00:00 2001 From: JoshuaLicense Date: Mon, 13 May 2024 09:16:33 +0100 Subject: [PATCH] feat: check version in environment variable --- config/autoload/config.global.php | 7 ++++++- config/autoload/local.php.dist | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/autoload/config.global.php b/config/autoload/config.global.php index 4416c89d7..ce5827bf2 100644 --- a/config/autoload/config.global.php +++ b/config/autoload/config.global.php @@ -6,10 +6,15 @@ // But for now, it's not. So we have to do it here. $isProduction = strtoupper($environment) === 'APP'; +// ECS will now set the version via. environment variables. +// Once fully migrated, the `../version` file can be removed, and this can be simplified. +$ecsVersion = getenv('APP_VERSION'); +$ec2Version = file_exists(__DIR__ . '/../version') ? file_get_contents(__DIR__ . '/../version') : null; + return [ 'version' => $isProduction ? null : [ 'environment' => $environment, - 'release' => (file_exists(__DIR__ . '/../version') ? file_get_contents(__DIR__ . '/../version') : ''), + 'release' => ($ecsVersion ?: $ec2Version ?: 'LOCAL'), 'description' => '%domain%', ], 'api_router' => [ diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 4175fdf39..a492760eb 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -8,7 +8,6 @@ return [ // Debugging, display environment and version on interface 'version' => [ 'environment' => 'localdev', - 'release' => (file_exists(__DIR__ . '/../version') ? file_get_contents(__DIR__ . '/../version') : ''), 'description' => 'olcs.localdev', ],