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 <?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 // New configuration array for Client-Options
$redis_options = array(); $redis_options = array();
// some default values... // some default values...
$redis_options["schema"] = "tcp"; $redis_options["schema"] = get_cfg_from_env("REDIS_OPTIONS_SCHEMA","tcp");
$redis_options["host"] = "localhost"; $redis_options["host"] = get_cfg_from_env("REDIS_OPTIONS_HOST","localhost");
$redis_options["port"] = 6379; $redis_options["port"] = get_cfg_from_env("REDIS_OPTIONS_PORT",6379);
$redis_options["password"] = "password"; $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 ... // read configuration from file if exists ...
if( is_file("./.htconfig.php") ) { if( is_file("./.htconfig.php") ) {
include_once("./.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="page">
<div id="header"> <div id="header">
<a href="/"><img style="border:none" src="logo.png" width="192" height="85" alt="Retwis"></a> <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") ?> <?php include("navbar.php") ?>
</div> </div>