public static MockHiveMetaStoreConf loadAndOverrideExtraEnvironmentVariables()

in hms-lambda-rnp/src/main/java/com/amazonaws/athena/MockHiveMetaStoreConf.java [45:74]


  public static MockHiveMetaStoreConf loadAndOverrideExtraEnvironmentVariables()
  {
    Configuration hmsConf = Configuration.loadDefaultFromClasspath(HMS_PROPERTIES);

    MockHiveMetaStoreConf conf = new MockHiveMetaStoreConf();

    conf.setConnectionURL(hmsConf.getProperty(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname));
    conf.setConnectionDriverName(hmsConf.getProperty(HiveConf.ConfVars.METASTORE_CONNECTION_DRIVER.varname));
    conf.setConnectionPassword(hmsConf.getProperty(HiveConf.ConfVars.METASTOREPWD.varname));
    conf.setConnectionUserName(hmsConf.getProperty(HiveConf.ConfVars.METASTORE_CONNECTION_USER_NAME.varname));
    conf.setMetastoreWarehouse(hmsConf.getProperty(HiveConf.ConfVars.METASTOREWAREHOUSE.varname));

    conf.setMetastoreSetUgi(hmsConf.getBoolean(HiveConf.ConfVars.METASTORE_EXECUTE_SET_UGI.varname, true));
    conf.setResponseSpillLocation(hmsConf.getProperty(HMS_RESPONSE_SPILL_LOCATION));
    conf.setResponseSpillThreshold(hmsConf.getLong(HMS_RESPONSE_SPILL_THRESHOLD, DEFAULT_HMS_RESPONSE_SPILL_THRESHOLD));
    conf.setHandlerNamePrefix(hmsConf.getString(HMS_HANDLER_NAME_PREFIX, DEFAULT_HMS_HANDLER_NAME_PREFIX));
    conf.setResponseSpillLocation(hmsConf.getProperty(HMS_RESPONSE_RECORD_LOCATION));
    // override parameters with Lambda Environment variables
    // String hmsUris = System.getenv(ENV_HMS_URIS);

    String spillLocation = System.getenv(ENV_SPILL_LOCATION);
    if (!Strings.isNullOrEmpty(spillLocation)) {
      conf.setResponseSpillLocation(spillLocation);
    }
    String recordLocation = System.getenv(ENV_RECORD_LOCATION);
    if (!Strings.isNullOrEmpty(recordLocation)) {
      conf.setResponseRecordLocation(recordLocation);
    }
    return conf;
  }