-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add make targets to dump file storage
- Loading branch information
Spine
committed
May 6, 2021
1 parent
6bb370a
commit fec3aea
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#! /usr/bin/env php | ||
<?php | ||
|
||
/** | ||
* A command-line tool to expose configuration values | ||
* Switches: | ||
* -j encode the output as JSON (useful for arrays) | ||
* | ||
* usage: | ||
* getconf SQLPASS | ||
* (prints the db password) | ||
* | ||
* getconf -j RANKING_WEIGHT | ||
* try it :) | ||
*/ | ||
|
||
require_once(__DIR__ . '/../classes/config.php'); | ||
|
||
array_shift($argv); | ||
$multi = count($argv) > 1; | ||
$json = false; | ||
|
||
foreach ($argv as $arg) { | ||
switch($arg) { | ||
case '-j': | ||
$json = !$json; | ||
break; | ||
default: | ||
$value = get_defined_constants()[$arg]; | ||
if ($json) { | ||
echo json_encode($multi ? [$arg => $value] : $value), "\n"; | ||
} else { | ||
echo ($multi ? "$arg: $value" : $value), "\n"; | ||
} | ||
} | ||
} |