Retwis Title configuration option

This commit is contained in:
Frank Agerholm 2019-01-16 17:41:14 +01:00
commit 5fd9c7c349
2 changed files with 17 additions and 13 deletions

View file

@ -1,26 +1,30 @@
<?php
function get_cfg_from_env($name, $default='') {
$ret = null;
$tmp = getent($name);
if( isset($tmp) and $tmp != '' ) {
$ret = $tmp;
}
return $ret;
}
// New configuration array for Client-Options
$redis_options = array();
// some default values...
$redis_options["schema"] = "tcp";
$redis_options["host"] = "localhost";
$redis_options["port"] = 6379;
$redis_options["password"] = "password";
$redis_options["schema"] = get_cfg_from_env("REDIS_OPTIONS_SCHEMA","tcp");
$redis_options["host"] = get_cfg_from_env("REDIS_OPTIONS_HOST","localhost");
$redis_options["port"] = get_cfg_from_env("REDIS_OPTIONS_PORT",6379);
$redis_options["password"] = get_cfg_from_env("REDIS_OPTIONS_PASSWORD","password");
$redis_title = get_cfg_from_env("REDIS_TITLE","");
// read configuration from file if exists ...
if( is_file("./.htconfig.php") ) {
include_once("./.htconfig.php");
}
// get redis configuration options from environment variables
foreach( $redis_options as $k => $v) {
$tmp = getenv(strtoupper("REDIS_OPTIONS_" . $k));
if( isset($tmp) and $tmp != '' ) {
$redis_options[$k] = $tmp;
}
}
?>

View file

@ -9,6 +9,6 @@
<div id="page">
<div id="header">
<a href="/"><img style="border:none" src="logo.png" width="192" height="85" alt="Retwis"></a>
<?php echo gethostname(); ?>
<?php echo $redis_title; ?>
<?php include("navbar.php") ?>
</div>