add option -c
This commit is contained in:
parent
0d77a94124
commit
0ed58b6449
|
@ -26,4 +26,4 @@ hook_url = "https://mattermost.example.com/hooks/1234567890abcdefghijklm"
|
||||||
message_template = "« %1$s » %2$s #foo #bar"
|
message_template = "« %1$s » %2$s #foo #bar"
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run `php index.php`.
|
Then run `php index.php`. You can specify the path of the configuration file using `php index.php -c /path/to/config.ini`;
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
chdir(__DIR__);
|
chdir(__DIR__);
|
||||||
|
|
||||||
$config = parse_ini_file('config.ini', true);
|
$options = getopt("c:");
|
||||||
|
|
||||||
|
$config = parse_ini_file($options['c'] ?? 'config.ini', true);
|
||||||
|
|
||||||
$feedUrl = $config['feed']['url'];
|
$feedUrl = $config['feed']['url'];
|
||||||
$hookUrl = $config['mattermost']['hook_url'];
|
$hookUrl = $config['mattermost']['hook_url'];
|
||||||
$cacheFile = $config['cache']['file'];
|
$cacheFile = $config['cache']['file'];
|
||||||
$template = $config['mattermost']['message_template'];
|
$template = $config['mattermost']['message_template'];
|
||||||
|
|
||||||
|
|
||||||
if (file_exists($cacheFile)) {
|
if (file_exists($cacheFile)) {
|
||||||
$cache = json_decode(file_get_contents($cacheFile), true);
|
$cache = json_decode(file_get_contents($cacheFile), true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue