protected function setUp() { parent::setUp(); file_put_contents(__DIR__ . '/../fixtures/data/.env', "test=test\ntestTrue=true\ntestFalse=false\ntestNull=null\ntestEmpty"); $dotenv = new Dotenv(__DIR__ . '/../fixtures/data/'); $dotenv->load(); }
/** * use vlucas dotenv to access the .env file **/ protected function loadDotenv() { if (getenv('APP_ENV') !== 'production') { $dotenv = new Dotenv(__DIR__); $dotenv->load(); } }
/** * Load Dotenv to grant getenv() access to environment variables in .env file * * @return Values */ protected static function loadEnv() { if (!getenv("APP_ENV")) { $dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']); $dotenv->load(); } }
public static function setUpBeforeClass() { if (file_exists(__DIR__ . '/../.env')) { $dotenv = new Dotenv(__DIR__ . '/../'); $dotenv->load(); } }
public function __construct(string $configDir = __DIR__ . '/../../../../../', bool $isSandbox = false, string $configFile = '.env') { $config = new Dotenv($configDir, $configFile); $config->load(); $config->required(['YANDEX_LOGIN', 'DIRECT_API_TOKEN', 'DIRECT_API_MASTER_TOKEN', 'DIRECT_API_SANDBOX_MASTER_TOKEN', 'DIRECT_ACCEPT_LANGUAGE']); $this->sandbox = $isSandbox; }
/** * use vlucas dotenv to access the .env file **/ public static function loadenv() { if (getenv('APP_ENV') !== 'production') { $dotenv = new Dotenv(__DIR__); $dotenv->load(); } }
/** * load environment parameters * @return resource */ public static function loadenv() { if (!getenv('APP_ENV') == 'production') { $dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']); $dotenv->load(); } }
protected function setUp() { $dotenv = new Dotenv(__DIR__ . '/../'); $dotenv->load(); $uri = getenv('DATABASE_SERVER'); $this->client = new Client(['base_uri' => "http://" . $uri]); }
/** * HttpHelper constructor. */ public function __construct() { $this->guzzle = new Client(); $dotenv = new Dotenv(__DIR__ . '/../'); $dotenv->load(); $dotenv->required(['API_USERNAME', 'API_PASSWORD', 'SONAR_URL'])->notEmpty(); }
protected static function createDatabase() { if (empty(getenv('PGSQL_HOST')) && file_exists(__DIR__ . '/../../.env')) { $dotenv = new Dotenv(__DIR__ . '/../../'); $dotenv->load(); } if (empty(getenv('PGSQL_HOST')) || empty(getenv('PGSQL_USER'))) { throw new \RuntimeException('Create a .env file with PGSQL_HOST, PGSQL_USER, and PGSQL_PASS to run this test.'); } $pass = getenv('PGSQL_PASS') ? getenv('PGSQL_PASS') : ''; $pdo = new \PDO('pgsql:host=' . getenv('PGSQL_HOST'), getenv('PGSQL_USER'), $pass); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); self::$connection = DriverManager::getConnection(['driver' => 'pdo_pgsql', 'pdo' => $pdo, 'dbname' => 'public']); self::$connection->query('drop schema public cascade'); self::$connection->query('create schema public'); self::$connection->query('CREATE TABLE extended_data_objects ( id SERIAL PRIMARY KEY, "isDeleted" BOOLEAN NOT NULL DEFAULT FALSE, "myColumn" VARCHAR(255) NOT NULL, "myNullableColumn" INT NULL DEFAULT NULL, "otherDataObjectId" INT NULL )'); self::$connection->query('CREATE TABLE other_data_objects ( id SERIAL PRIMARY KEY, "isDeleted" BOOLEAN NOT NULL DEFAULT FALSE, "name" VARCHAR(255) NOT NULL, "extendedDataObjectId" INT NULL REFERENCES extended_data_objects (id) )'); self::$connection->query('CREATE TABLE extended_other_rel ( "extendedDataObjectId" INT NOT NULL REFERENCES extended_data_objects (id), "otherDataObjectId" INT NOT NULL REFERENCES other_data_objects (id) )'); }
public function setUp() { $dotenv = new Dotenv(__DIR__ . '/../'); $dotenv->load(); $this->guzzle = m::mock(Client::class); $this->endpoint = getenv('MAILCHIMP_ENDPOINT'); }
public function __construct() { $dotenv = new Dotenv(__DIR__ . "/../"); $dotenv->load(); $dotenv->required("MYSQL_PASSWORD"); $this->climate = new CLImate(); }
public function testArrayInstantiation() { $dotEnv = new Dotenv('./'); $dotEnv->load(); $data = ['username' => getenv('CARAVANA_USERNAME'), 'password' => getenv('CARAVANA_PASSWORD'), 'clientId' => getenv('CARAVANA_CLIENT_ID'), 'clientSecret' => getenv('CARAVANA_CLIENT_SECRET'), 'grantType' => getenv('CARAVANA_GRANT_TYPE'), 'accessToken' => getenv('CARAVANA_ACCESS_TOKEN'), 'authEndPoint' => getenv('CARAVANA_AUTH_ENDPOINT'), 'apiEndPoint' => getenv('CARAVANA_API_ENDPOINT')]; $api = new Api($data); $this->assertInstanceOf('Caravana\\API\\Api', $api); }
function start() { // Load .env to be able to access configuration variables $dotenv = new Dotenv(__DIR__); $dotenv->load(); $wolf = new Slackwolf(getenv('BOT_TOKEN')); $wolf->run(); }
/** * Parses environment file */ protected function parseEnvironmentVariables() { if ($this->allowOverloading) { $this->dotEnv->overload(); } else { $this->dotEnv->load(); } }
public function setUp() { $dotenv = new Dotenv(__DIR__ . '/../'); $dotenv->load(); if ($_ENV['COINFIDE_USER'] == 'yourapiusername') { die('Please copy .env.example file to .env and fill in your Coinfide credentials'); } }
/** * Set the environment variables. * * @return array|bool */ private function _setEnv() { if (!file_exists(base_path('.env'))) { return false; } $env = new Dotenv(base_path()); return $env->load(); }
/** * Use Dotenv to set required environment variables from .env file in root */ protected function loadEnv() { try { $this->dotenv->load(); $this->dotenv->required($this->required); } catch (\InvalidArgumentException $e) { // Assuming env data is set by server } }
protected function loadDotEnv() { # - load the .env file, that will enteract with # configurations, for environment specific if (file_exists($this->base . '/.env')) { $dotenv = new Dotenv($this->base); $dotenv->load(); } }
public static function load() { if (!getenv('APP_ENV') || getenv('APP_ENV') == "local") { // load config values from .env file if APP_ENV is not found. // APP_ENV is set on Heroku server $dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']); $dotenv->load(); } }
public function setUp() { $dotenv = new Dotenv(__DIR__ . '/../'); $dotenv->load(); $api_key = getenv('WAKATIME_API_KEY'); $this->project = getenv('WAKATIME_PROJECT'); // Arrange $this->wakatime = new WakaTime(new Guzzle(), $api_key); }
protected function doTest($attributes) { $dotenv = new Dotenv(__DIR__ . '/..'); $dotenv->load(); $model = new DummyModel($attributes); $model_attributes = $model->getAttributes(); $this->assertEquals($attributes['dont_encrypt'], $model->attributes['dont_encrypt']); $this->assertStringStartsWith('__ELOCRYPT__:', $model->attributes['encrypt_me']); $this->assertEquals($attributes['encrypt_me'], $model_attributes['encrypt_me']); }
/** * Add the configuration from the environment to a container * * @param Container $container The container * @param string $alias An optional alias, defaults to 'config' * * @return void */ public function register(Container $container, $alias = 'config') { $file = '.env'; if ($container->has('ConfigFileName')) { $file = $container->get('ConfigFileName'); } $dotenv = new Dotenv($container->get('ConfigDirectory'), $file); $dotenv->overload(); $container->set($alias, new Registry($_ENV), true); }
protected function setUp() { $dotenv = new Dotenv(__DIR__); $dotenv->load(); $this->apiKey = getenv('lastfm_api_key'); $this->apiSecret = getenv('lastfm_api_secret'); $this->token = getenv('lastfm_token'); $this->sessionKey = getenv('lastfm_session_key'); $this->username = getenv('lastfm_username'); }
/** * @inheritdoc */ public function register(Container $container) { $container['dotenv'] = function (Container $container) { $dotenv = new Dotenv(__DIR__ . '/../..'); $dotenv->load(); // Requiring Variables to be Set $dotenv->required('APP_DEBUG'); $this->addEnvVarsToApp($container); }; }
public function __construct() { $dotenv = new Dotenv(__DIR__ . "/../"); $dotenv->load(); $this->github_username = getenv('github_username'); $this->github_repo = getenv('github_repo'); $this->github_password = getenv('github_password'); $this->github_client_id = getenv('client_id'); $this->github_client_secret = getenv('client_secret'); }
public function __construct() { $dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']); $dotenv->load(); $this->db_host = getenv('db_host'); $this->db_name = getenv('db_name'); $this->db_user = getenv('db_user'); $this->database = getenv('database'); $this->db_password = getenv('db_password'); }
/** * Load Dotenv to grant getenv() access to environment variables in .env file. */ public function loadEnv() { if (!getenv('APP_ENV')) { $dotenv = new Dotenv(__DIR__ . '/../'); $dotenv->load(); } }
private function loadDotEnv() { if (getenv("APP_ENV") !== "production") { $dotenv = new Dotenv(__DIR__ . "/.."); $dotenv->load(); } }
/** * Update wp-cli.yml with settings from .env files * * ## OPTIONS * * <environment> * : The name of the environment to set. Typically matched by a .env-<environemnt> file in the project root * * @param $args * @param $assocArgs * * @when before_wp_load */ public function __invoke($args, $assocArgs) { $environment = $args[0]; if (file_exists(WPBOOT_BASEPATH . "/.env")) { $dotEnv = new Dotenv(WPBOOT_BASEPATH); $dotEnv->load(); } $file = '.env-' . $environment; if (file_exists(WPBOOT_BASEPATH . "/{$file}")) { $dotEnv = new Dotenv(WPBOOT_BASEPATH, $file); $dotEnv->overload(); } try { $dotEnv = new Dotenv(__DIR__); $dotEnv->required('wppath'); } catch (\Exception $e) { echo $e->getMessage() . "\n"; return; } $runner = WP_CLI::get_runner(); $ymlPath = $runner->project_config_path; $yaml = new Yaml(); $config = $yaml->parse(file_get_contents($ymlPath)); $config['path'] = $_ENV['wppath']; $config['environment'] = $environment; $dumper = new Dumper(); file_put_contents($ymlPath, $dumper->dump($config, 2)); }