
com.google.apphosting.vmruntime.VmRuntimeUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-http-appengine-adapter Show documentation
Show all versions of fluent-http-appengine-adapter Show documentation
An App Engine Adapter for Fluent-http
The newest version!
/**
* Copyright 2014 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.apphosting.vmruntime;
import static com.google.appengine.repackaged.com.google.common.base.MoreObjects.firstNonNull;
public class VmRuntimeUtils {
private static final String VM_API_PROXY_HOST = "appengine.googleapis.com";
private static final int VM_API_PROXY_PORT = 10001;
public static final long ONE_DAY_IN_MILLIS = 24 * 60 * 60 * 1000;
public static final long MAX_USER_API_CALL_WAIT_MS = 60 * 1000;
/**
* Returns the host:port of the API server.
*
* @return If environment variables API_HOST or API_PORT port are set the host and/or port is
* calculated from them. Otherwise the default host:port is used.
*/
public static String getApiServerAddress() {
String server = firstNonNull(System.getenv("API_HOST"), VM_API_PROXY_HOST);
String port = firstNonNull(System.getenv("API_PORT"), "" + VM_API_PROXY_PORT);
return server + ":" + port;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy