|
|
@@ -2,15 +2,13 @@
|
|
|
|
|
|
namespace Opentalent\OtCore\Service;
|
|
|
|
|
|
-use http\Exception\RuntimeException;
|
|
|
-
|
|
|
/**
|
|
|
- * Return the current opentalent environment variables
|
|
|
+ * Manage the opentalent environment variables
|
|
|
*
|
|
|
* To override the default values for a specific environment, set the new values as
|
|
|
* global variables as $GLOBALS['OT']['YOUR_VAR']
|
|
|
*
|
|
|
- * A goot place to do that is in the AdditionalConfiguration.php file of your typo3 installation,
|
|
|
+ * A good place to do that is in the AdditionalConfiguration.php file of your typo3 installation,
|
|
|
* by adding for example:
|
|
|
*
|
|
|
* $GLOBALS['OT']['DB_HOST'] = 'db';
|
|
|
@@ -18,18 +16,10 @@ use http\Exception\RuntimeException;
|
|
|
*/
|
|
|
class OpentalentEnvService
|
|
|
{
|
|
|
- const DEFAULT = [
|
|
|
- 'API_BASE_URI' => 'https://api.opentalent.fr',
|
|
|
- 'DB_HOST' => 'prod-back',
|
|
|
- 'DB_USER' => 'dbcloner',
|
|
|
- 'DB_PASSWORD' => 'wWZ4hYcrmHLW2mUK',
|
|
|
- 'FRAMES_BASE_URI' => 'https://frames.opentalent.fr'
|
|
|
- ];
|
|
|
-
|
|
|
public static function get($varname) {
|
|
|
- if (!array_key_exists($varname, self::DEFAULT)) {
|
|
|
- throw new \RuntimeException('Unexisting environment variable requested: ' . $varname);
|
|
|
+ if (!array_key_exists($varname, $GLOBALS['OT'])) {
|
|
|
+ throw new \RuntimeException('Unexisting OT environment variable requested: ' . $varname);
|
|
|
}
|
|
|
- return $GLOBALS['OT'][$varname] ?? self::DEFAULT[$varname];
|
|
|
+ return $GLOBALS['OT'][$varname];
|
|
|
}
|
|
|
}
|