public int getInt(String key) { int ret = config.getInt(key, -1); if (ret == -1) { logger.warn("int property not found: {}", key); } return ret; }
public static Connection getConnection(Configuration config) throws SQLException { String dbtype = config.getString("DB_TYPE"); switch (dbtype) { case "mysql": dataSource.setDriverClassName("com.mysql.jdbc.Driver"); } dataSource.setUrl( "jdbc:" + dbtype + "://" + config.getString("DB_HOSTNAME") + "/" + config.getString("DB_NAME") + "?autoReconnect=true&useSSL=false&rewriteBatchedStatements=true"); dataSource.setUsername(config.getString("DB_USER")); dataSource.setPassword(config.getString("DB_PASS")); return dataSource.getConnection(); }
public boolean isLocal() { return config.getString("environment", "").equals("local"); }
public String getString(String key, String def) { return config.getString(key, def); }
public int getInt(String key, int def) { return config.getInt(key, def); }
public boolean getBoolean(String key, Boolean def) { return config.getBoolean(key, def); }
public boolean getBoolean(String key) { return config.getBoolean(key); }