- added option to add custom *.ini files into /conf dir (enabled environment.ini)

- enable "dynamic token" in *.ini files (variables)
- improved map sync behaviour: Force map changes to be send to server when a clients "unloads/reloads" a tab.
- fixed Js build bug in Firefox. "js-uglify" no longer crashes FF when Dev-Tools are open
- enabled "js-hint" in Js build process.
This commit is contained in:
Exodus4D
2017-07-22 14:33:36 +02:00
parent c877d9c7f8
commit e9d50d4294
8 changed files with 47 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
; Global Framework Config
[SERVER]
SERVER_NAME = PATHFINDER
SERVER_NAME = PATHFINDER
[globals]
; Default Verbosity level of the stack trace.
@@ -23,7 +23,6 @@ CACHE = folder=tmp/cache/
; Callback functions ==============================================================================
ONERROR = Controller\Controller->showError
UNLOAD = Controller\Controller->unload
; Path configurations =============================================================================
@@ -50,11 +49,15 @@ EXPORT = export/
; Default language (overwrites HTTP Accept-Language request header) used for "setlocale()" affects number formatting. (default: en-US)
LANGUAGE = en-US
; custom *.ini file folder, can be used to overwrite default *.ini files
CONF.CUSTOM = conf/
CONF.DEFAULT = app/
; load additional config files
; DO NOT load environment.ini, it is loaded automatically
[configs]
app/routes.ini = true
app/pathfinder.ini = true
conf/pathfinder.ini = true
app/requirements.ini = true
app/cron.ini = true
{{@CONF.DEFAULT}}routes.ini = true
{{@CONF.DEFAULT}}pathfinder.ini = true
{{@CONF.CUSTOM}}pathfinder.ini = true
{{@CONF.DEFAULT}}requirements.ini = true
{{@CONF.DEFAULT}}cron.ini = true

View File

@@ -11,7 +11,7 @@ SERVER = DEVELOP
; -> e.g. set /pathfinder if your URL looks like https://www.[YOUR_DOMAIN]/pathfinder (subfolder)
BASE =
; deployment URL (e.g. http://localhost)
URL = http://local.pathfinder
URL = {{@SCHEME}}://local.pathfinder
; level of debug/error stack trace
DEBUG = 3
; main db
@@ -57,7 +57,7 @@ SMTP_ERROR = pathfinder@localhost.com
; -> e.g. set /pathfinder if your URL looks like https://www.[YOUR_DOMAIN]/pathfinder (subfolder)
BASE =
; deployment URL (e.g. https://www.pathfinder-w.space)
URL = https://www.pathfinder-w.space
URL = {{@SCHEME}}://www.pathfinder-w.space
; level of debug/error stack trace
DEBUG = 0
; main db

View File

@@ -22,7 +22,7 @@ class Setup extends Controller {
* @var array
*/
protected $environmentVars = [
'TYPE',
'ENVIRONMENT_CONFIG',
'BASE',
'URL',
'DEBUG',

View File

@@ -96,17 +96,24 @@ class Config extends \Prefab {
$item = (in_array($key, self::ARRAY_KEYS)) ? explode(',', $item) : $item;
});
$environmentData['TYPE'] = 'PHP: environment variables';
$environmentData['ENVIRONMENT_CONFIG'] = 'PHP: environment variables';
}else{
// get environment data from *.ini file config
$f3->config('app/environment.ini');
$customConfDir = $f3->get('CONF');
if(
$f3->exists(self::HIVE_KEY_ENVIRONMENT) &&
($environment = $f3->get(self::HIVE_KEY_ENVIRONMENT . '.SERVER')) &&
($environmentData = $f3->get(self::HIVE_KEY_ENVIRONMENT . '.' . $environment))
){
$environmentData['TYPE'] = 'Config: environment.ini';
// check "custom" ini dir, of not found check default ini dir
foreach($customConfDir as $type => $path){
$envConfFile = $path . 'environment.ini';
$f3->config($envConfFile, true);
if(
$f3->exists(self::HIVE_KEY_ENVIRONMENT) &&
($environment = $f3->get(self::HIVE_KEY_ENVIRONMENT . '.SERVER')) &&
($environmentData = $f3->get(self::HIVE_KEY_ENVIRONMENT . '.' . $environment))
){
$environmentData['ENVIRONMENT_CONFIG'] = 'Config: ' . $envConfFile;
break;
}
}
}

View File

@@ -90,7 +90,7 @@ let trackTable = {
// https://www.npmjs.com/package/uglify-es
let uglifyJsOptions = {
warnings: true,
toplevel: true
toplevel: false
};
// Sourcemaps options
@@ -795,7 +795,7 @@ gulp.task('task:buildCss', gulp.series(
gulp.task(
'task:watchJsSrc',
gulp.series(
// 'task:hintJS',
'task:hintJS',
'task:diffJS',
'task:updateJsDest'
)

View File

@@ -9,7 +9,7 @@ if(file_exists($composerAutoloader)){
$f3 = require_once('app/lib/base.php');
// load main config
$f3->config('app/config.ini');
$f3->config('app/config.ini', true);
// load environment dependent config
lib\Config::instance();

View File

@@ -377,6 +377,14 @@ define([
// initial start of the map update function
triggerMapUpdatePing(true);
// Send map update request on tab close/reload, in order to save map changes that
// haven´t been saved through default update trigger
window.addEventListener('beforeunload', function(e) {
triggerMapUpdatePing();
// IMPORTANT, return false in order to not "abort" ajax request in background!
return false;
});
};
});

View File

@@ -377,6 +377,14 @@ define([
// initial start of the map update function
triggerMapUpdatePing(true);
// Send map update request on tab close/reload, in order to save map changes that
// haven´t been saved through default update trigger
window.addEventListener('beforeunload', function(e) {
triggerMapUpdatePing();
// IMPORTANT, return false in order to not "abort" ajax request in background!
return false;
});
};
});