blob: 5c4383e7abab98084b1dd16b0c8f1438c9faea4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
/**
* Environment Variable Configuration
*
* PHP version 5.2
*
* @author Matt Bernier <dx@sendgrid.com>
* @author Elmer Thomas <dx@sendgrid.com>
* @copyright 2016 SendGrid
* @license https://opensource.org/licenses/MIT The MIT License
* @version GIT: <git_id>
* @link http://packagist.org/packages/sendgrid/php-http-client
*/
namespace SendGrid;
/**
* Sets environment variables.
*/
class Config
{
/**
* Setup the environment variables
*
* @param string $base_path path to your config file.
* @param string $config_filename name of the config file.
*/
function __construct($base_path, $config_filename)
{
$handle = fopen($base_path.'/'.$config_filename, "r");
while (($line = fgets($handle)) !== false) {
putenv(trim(preg_replace('/\s+/', ' ', $line)));
}
fclose($handle);
}
}
?>
|