Example usage for java.lang System getenv

List of usage examples for java.lang System getenv

Introduction

In this page you can find the example usage for java.lang System getenv.

Prototype

public static String getenv(String name) 

Source Link

Document

Gets the value of the specified environment variable.

Usage

From source file:co.aurasphere.botmill.fb.test.api.UploadApiTest.java

private boolean isConfigurationExist() {
    if (System.getenv("fb.page.token") != null && System.getenv("fb.validation.token") != null) {
        return true;
    }//from   w  w  w. j  a  v a 2  s.  c  om
    return false;
}

From source file:com.egt.core.aplicacion.Bitacora.java

private static String getKeyValue(String key) {
    String clave = key;/*from  w  ww.ja  v  a2s.  co  m*/
    String value = System.getenv(clave);
    if (StringUtils.isBlank(value)) {
        System.out.println(clave + "=");
        clave = key.replace('_', '.').toLowerCase();
        value = System.getProperties().getProperty(clave);
    }
    String trimmed = StringUtils.trimToEmpty(value);
    System.out.println(clave + "=" + trimmed);
    return trimmed;
}

From source file:com.alehuo.wepas2016projekti.configuration.ProductionConfiguration.java

/**
 * Heroku -palvelussa kytetn PostgreSQL -tietokantaa tiedon
 * tallentamiseen. Tm metodi hakee herokusta tietokantayhteyden
 * mahdollistavat ympristmuuttujat./*  w  w  w.j a  va 2  s  .c om*/
 *
 * @return @throws URISyntaxException
 */
@Bean
public BasicDataSource dataSource() throws URISyntaxException {
    URI dbUri = new URI(System.getenv("DATABASE_URL"));

    String username = dbUri.getUserInfo().split(":")[0];
    String password = dbUri.getUserInfo().split(":")[1];
    String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + dbUri.getPath();

    BasicDataSource basicDataSource = new BasicDataSource();
    basicDataSource.setUrl(dbUrl);
    basicDataSource.setUsername(username);
    basicDataSource.setPassword(password);

    //Autocommit pois plt
    basicDataSource.setDefaultAutoCommit(false);

    return basicDataSource;
}

From source file:io.vitess.client.TestEnv.java

public String getTestDataPath() {
    String vtTop = System.getenv("VTTOP");
    if (vtTop == null) {
        throw new RuntimeException("cannot find env variable: VTTOP");
    }//  w  w w  . j av a2 s  .  com
    return vtTop + "/data/test";
}

From source file:com.handywedge.binarystore.rest.api.BinaryStoreServiceController.java

/**
 * //from  w w w  . j a va  2  s  . c o m
 *
 * @throws StoreException
 */
public BinaryStoreServiceController() throws StoreException {
    String curStorage = System.getenv("HW_STORAGE");
    logger.debug("storage={}", curStorage);
    if (curStorage == null) {
        curStorage = "";
    }
    switch (curStorage) {
    case "S3":
        storage = new StorageInfo("S3");
        manager = new com.handywedge.binarystore.store.aws.BinaryStoreManagerImpl();
        break;
    case "GCS":
        storage = new StorageInfo("GCS");
        manager = new com.handywedge.binarystore.store.gcs.BinaryStoreManagerImpl();
        break;
    case "ABS":
        storage = new StorageInfo("ABS");
        manager = new com.handywedge.binarystore.store.azure.BinaryStoreManagerImpl();
        break;
    default:
        break;
    }
}

From source file:me.figo.internal.FigoTrustManager.java

private static List<String> getFingerprintsFromEnv() {
    String fingerprintList = System.getenv("FIGO_API_FINGERPRINTS");
    return Arrays.asList(fingerprintList.split(":"));
}

From source file:com.comcast.dawg.selenium.ChromeDriverProvider.java

/**
 * Provides the appropriate chromedriver for the currently running os.
 *
 * @throws  IOException  if we're unable to determine the os
 *//* ww  w .ja  va2  s .  co  m*/
public File getDriverFile() throws IOException {
    String driver;
    String filename;
    String chromeDriverPath = System.getProperty(SYSTEM_PROP_KEY);
    chromeDriverPath = chromeDriverPath == null ? System.getenv(ENV_KEY) : chromeDriverPath;
    if (chromeDriverPath == null) {
        if (isWindows) {
            driver = WINDOWS;
            filename = WINDOWS_FILENAME;
        } else if (isLinux) {
            filename = LINUX_FILENAME;

            if (is32bit()) {
                driver = LINUX_32;
            } else {
                driver = LINUX_64;
            }
        } else if (isMac) {
            filename = MAC_FILENAME;
            driver = MAC_32;
        } else {
            System.out.println(this.toString());

            // We're on an unknown OS and the driver won't run.
            throw new IOException("A compatible executable could not be determined for this operating system");
        }

        System.out.println("Getting resource for: " + driver + " having filename: " + filename);
        System.out.println(ChromeDriverProvider.class.getResource(DRIVER_DIR + driver));

        InputStream srcFile = ChromeDriverProvider.class.getResourceAsStream(DRIVER_DIR + driver);
        File destFile = new File(USER_HOME + TEMP_DIR + filename);

        copyFile(srcFile, destFile);
        destFile.setExecutable(true);

        return destFile;
    } else {
        return new File(chromeDriverPath);
    }
}

From source file:com.controller.payment.PaymentClient.java

public void executePayment(String paymentId, String payerId) throws PayPalRESTException {

    Properties properties = new Properties();
    properties.setProperty("http.ConnectionTimeOut", "5000");

    properties.setProperty("http.Retry", "1");
    properties.setProperty("http.ReadTimeOut", "30000");
    properties.setProperty("http.MaxConnection", "100");
    properties.setProperty("http.UseProxy", "false");

    properties.setProperty("service.EndPoint", System.getenv("PAYPAL_API_SERVICE_ENDPOINT"));
    properties.setProperty("clientID", System.getenv("PAYPAL_API_CLIENT_ID"));
    properties.setProperty("clientSecret", System.getenv("PAYPAL_API_CLIENT_SECRET"));

    Payment.initConfig(properties);//from  www .j  a  v a  2 s.  com

    OAuthTokenCredential tokenCredential = new OAuthTokenCredential(
            ConfigManager.getInstance().getValue("clientID"),
            ConfigManager.getInstance().getValue("clientSecret"));

    String accessToken = tokenCredential.getAccessToken();

    Payment payment = Payment.get(accessToken, paymentId);

    PaymentExecution paymentExecution = new PaymentExecution();
    paymentExecution.setPayerId(payerId);

    Payment newPayment = payment.execute(accessToken, paymentExecution);

    List<Link> linkList = newPayment.getLinks();

    String paymentHref = null;

    for (Link link : linkList) {
        LOGGER.debug("PAYMENT EXECUTE LINK:" + link.getRel() + "" + link.getHref());

    }

}

From source file:eu.planets_project.pp.plato.services.characterisation.xcl.XclPropertiesExplorer.java

public XclPropertiesExplorer() {

    xclExplorerPath = System.getenv("XCLEXPLORER_HOME");
    if (xclExplorerPath != null) {
        xclExplorerPath = xclExplorerPath + (xclExplorerPath.endsWith(File.separator) ? "" : File.separator);
    } else {//from   w w  w  .  j  a  v  a  2 s .  com
        log.error("Environment variable XCLEXPLORER_HOME is not defined!");
    }
}

From source file:org.apache.metamodel.elasticsearch.rest.ElasticSearchRestDataContextIT.java

public static String determineHostName() throws URISyntaxException {
    final String dockerHost = System.getenv("DOCKER_HOST");

    if (dockerHost == null) {
        // If no value is returned for the DOCKER_HOST environment variable fall back to a default.
        return DEFAULT_DOCKER_HOST_NAME;
    } else {//from   w w w.  j ava 2s.  c  o  m
        return (new URI(dockerHost)).getHost();
    }
}