/** * Uses the runtime properties to determine if the core modules should be enforced or not. * * @return true if the core modules list can be ignored. */ public static boolean ignoreCoreModules() { String ignoreCoreModules = Context.getRuntimeProperties().getProperty(ModuleConstants.IGNORE_CORE_MODULES_PROPERTY, "false"); return Boolean.parseBoolean(ignoreCoreModules); }
/** * Indicates whether automatic database updates are allowed by this server. Automatic updates * are disabled by default. In order to enable automatic updates, the admin needs to add * 'auto_update_database=true' to the runtime properties file. * * @return true/false whether the 'auto_update_database' has been enabled. */ public static Boolean allowAutoUpdate() { String allowAutoUpdate = Context.getRuntimeProperties().getProperty( OpenmrsConstants.AUTO_UPDATE_DATABASE_RUNTIME_PROPERTY, "false"); return "true".equals(allowAutoUpdate); }
/** * @return true/false whether the 'allow upload' or 'allow web admin' property has been turned * on */ public static Boolean allowAdmin() { Properties properties = Context.getRuntimeProperties(); String prop = properties.getProperty(ModuleConstants.RUNTIMEPROPERTY_ALLOW_UPLOAD, null); if (prop == null) { prop = properties.getProperty(ModuleConstants.RUNTIMEPROPERTY_ALLOW_ADMIN, "false"); } return "true".equals(prop); }
/** * retrieve the secret key from runtime properties * * @return stored secret key byte array * @since 1.9 */ public static byte[] getSavedSecretKey() { String keyText = Context.getRuntimeProperties().getProperty(OpenmrsConstants.ENCRYPTION_KEY_RUNTIME_PROPERTY, OpenmrsConstants.ENCRYPTION_KEY_DEFAULT); if (StringUtils.hasText(keyText)) { return Base64.getDecoder().decode(keyText); } throw new APIException("no.encryption.secret.key.found", (Object[]) null); }
/** * retrieve the stored init vector from runtime properties * * @return stored init vector byte array * @since 1.9 */ public static byte[] getSavedInitVector() { String initVectorText = Context.getRuntimeProperties().getProperty( OpenmrsConstants.ENCRYPTION_VECTOR_RUNTIME_PROPERTY, OpenmrsConstants.ENCRYPTION_VECTOR_DEFAULT); if (StringUtils.hasText(initVectorText)) { return Base64.getDecoder().decode(initVectorText); } throw new APIException("no.encryption.initialization.vector.found", (Object[]) null); }
/** * Gets a database connection for liquibase to do the updates * * @return a java.sql.connection based on the current runtime properties */ public static Connection getConnection() throws Exception { Properties props = Context.getRuntimeProperties(); mergeDefaultRuntimeProperties(props); String driver = props.getProperty("hibernate.connection.driver_class"); String username = props.getProperty("hibernate.connection.username"); String password = props.getProperty("hibernate.connection.password"); String url = props.getProperty("hibernate.connection.url"); // hack for mysql to make sure innodb tables are created if (url.contains("mysql") && !url.contains("InnoDB")) { url = url + "&sessionVariables=default_storage_engine=InnoDB"; } Class.forName(driver); return DriverManager.getConnection(url, username, password); }
private void createSimpleSetup(String databaseRootPassword, String addDemoData) { setDatabaseNameIfInTestMode(); wizardModel.databaseConnection = Context.getRuntimeProperties().getProperty("connection.url", wizardModel.databaseConnection); wizardModel.createDatabaseUsername = Context.getRuntimeProperties().getProperty("connection.username", wizardModel.createDatabaseUsername);
String folderName = Context.getRuntimeProperties().getProperty(ModuleConstants.REPOSITORY_FOLDER_RUNTIME_PROPERTY); if (StringUtils.isBlank(folderName)) { AdministrationService as = Context.getAdministrationService();
filepath = systemProperty; } else { String runtimeProperty = Context.getRuntimeProperties() .getProperty(OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY, null); if (StringUtils.isNotBlank(runtimeProperty)) {
String appDataDirectory = Context.getRuntimeProperties().getProperty( OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY); if (StringUtils.isNotBlank(appDataDirectory)) {
Properties properties = Context.getRuntimeProperties();
public void execute(Database database) throws CustomChangeException { Properties runtimeProperties = Context.getRuntimeProperties();
wizardModel.canWrite = runtimeProperties.canWrite(); wizardModel.databaseConnection = Context.getRuntimeProperties().getProperty("connection.url", wizardModel.databaseConnection); wizardModel.currentDatabaseUsername = Context.getRuntimeProperties().getProperty("connection.username", wizardModel.currentDatabaseUsername); wizardModel.currentDatabasePassword = Context.getRuntimeProperties().getProperty("connection.password", wizardModel.currentDatabasePassword);
Properties properties = Context.getRuntimeProperties();
wizardModel.canWrite = runtimeProperties.canWrite(); wizardModel.databaseConnection = Context.getRuntimeProperties().getProperty("connection.url", wizardModel.databaseConnection); wizardModel.currentDatabaseUsername = Context.getRuntimeProperties().getProperty("connection.username", wizardModel.currentDatabaseUsername); wizardModel.currentDatabasePassword = Context.getRuntimeProperties().getProperty("connection.password", wizardModel.currentDatabasePassword); return; wizardModel.databaseConnection = Context.getRuntimeProperties().getProperty("connection.url", wizardModel.databaseConnection); wizardModel.createDatabaseUsername = Context.getRuntimeProperties().getProperty("connection.username", wizardModel.createDatabaseUsername);
new String(base64.encode(Security.generateNewSecretKey()), StandardCharsets.UTF_8)); Properties properties = Context.getRuntimeProperties(); properties.putAll(runtimeProperties); runtimeProperties = properties;
SchedulerUtil.startup(Context.getRuntimeProperties());