@@ -0,0 +1,1799 @@
+package eu.nimble.service.dashboard.services;%0A%0Aimport javax.enterprise.context.ApplicationScoped;%0Aimport javax.enterprise.event.Observes;%0Aimport javax.inject.Inject;%0A%0Aimport org.apache.marmotta.platform.core.api.config.ConfigurationService;%0Aimport org.apache.marmotta.platform.core.events.SystemStartupEvent;%0A%0A@ApplicationScoped%0Apublic class StartupConfigurator %7B%0A%09@Inject%0A%09ConfigurationService config;%0A%0A%09public StartupConfigurator() %7B%0A%09%09// TODO Auto-generated constructor stub%0A%09%7D%0A%09public void onSystemStartup(@Observes SystemStartupEvent event) %7B%0A%09%09%0A%09%09String%5B%5D databaseVal = new String %5B%5D %7B%22database.type%22,%22database.url%22,%22database.user%22,%22database.password%22 %7D;%0A%09%09String%5B%5D hostVal = new String %5B%5D %7B%22kiwi.path%22,%22kiwi.context%22,%22kiwi.host%22 %7D;%0A%09%09%0A%09%09if ( processEnvironmentVariables(databaseVal)) %7B%0A%09%09%09config.setBooleanConfiguration(%22kiwi.setup.database%22, Boolean.TRUE);%0A%09%09%7D%0A%09%09if ( processEnvironmentVariables(hostVal)) %7B%0A%09%09%09config.setBooleanConfiguration(%22kiwi.setup.host%22, Boolean.TRUE);%0A%09%09%7D%0A%09%09/*%0A%09%09%09security.enabled%0A%09%09%09database.type%0A%09%09%09database.url%0A%09%09%09database.user%0A%09%09%09database.password%0A%09%09%09kiwi.setup.database%0A%09%09%09kiwi.path%0A%09%09%09kiwi.context%0A%09%09%09kiwi.host%0A%09%09%09kiwi.setup.host%0A%09%09*/%0A%09%7D%0A%09%0A%0A%09private boolean processEnvironmentVariables(String%5B%5D variables) %7B%0A%09%09boolean variablesPresent = true;%0A%09%09String%5B%5D values = new String%5Bvariables.length%5D;%0A%09%09%0A%09%09for ( int i = 0; i %3C variables.length; i++ ) %7B%0A%09%09%09// try to get from environment%0A%09%09%09values%5Bi%5D = System.getenv(variables%5Bi%5D);%0A%09%09%0A%09%09%09if ( values%5Bi%5D  == null ) %7B%0A%09%09%09%09values%5Bi%5D = System.getProperty(variables%5Bi%5D);%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09if ( values%5Bi%5D == null ) %7B%0A%09%09%09%09variablesPresent = false;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09if (variablesPresent) %7B%0A%09%09%09for ( int i = 0; i %3C variables.length; i++) %7B%0A%09%09%09%09config.setConfiguration(variables%5Bi%5D, values%5Bi%5D);%0A%09%09%09%7D%0A%09%09%09return true;%0A%09%09%7D%0A%09%09return false;%0A%09%7D%0A%0A%7D%0A

Configure Environment Variables for database and host