Esempio n. 1
0
 public int getInt(String key) {
   int ret = config.getInt(key, -1);
   if (ret == -1) {
     logger.warn("int property not found: {}", key);
   }
   return ret;
 }
Esempio n. 2
0
  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();
  }
Esempio n. 3
0
 public boolean isLocal() {
   return config.getString("environment", "").equals("local");
 }
Esempio n. 4
0
 public String getString(String key, String def) {
   return config.getString(key, def);
 }
Esempio n. 5
0
 public int getInt(String key, int def) {
   return config.getInt(key, def);
 }
Esempio n. 6
0
 public boolean getBoolean(String key, Boolean def) {
   return config.getBoolean(key, def);
 }
Esempio n. 7
0
 public boolean getBoolean(String key) {
   return config.getBoolean(key);
 }