mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
catch config() error in a more deliberate way to prevent issues with future code changes.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* EnvHelper.php
|
* EnvHelper.php
|
||||||
*
|
*
|
||||||
* -Description-
|
* Helper for manipulation of the .env file
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -123,16 +123,18 @@ class EnvHelper
|
|||||||
'INSTALL' => !file_exists(base_path('config.php')) ? 'true' : false, // if both .env and config.php are missing, assume install is needed
|
'INSTALL' => !file_exists(base_path('config.php')) ? 'true' : false, // if both .env and config.php are missing, assume install is needed
|
||||||
], [], $env_file);
|
], [], $env_file);
|
||||||
|
|
||||||
|
try {
|
||||||
config(['app.key' => $key]);
|
config(['app.key' => $key]);
|
||||||
|
} catch (BindingResolutionException $e) {
|
||||||
|
// called outside of Laravel, ignore config() failure
|
||||||
|
}
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} catch (ErrorException $e) {
|
} catch (ErrorException $e) {
|
||||||
throw new FileWriteFailedException($env_file, 0, $e);
|
throw new FileWriteFailedException($env_file, 0, $e);
|
||||||
} catch (BindingResolutionException $e) {
|
|
||||||
// called outside of Laravel, ignore config() failure
|
|
||||||
return $key;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user