mirror of
https://github.com/apache/sqoop.git
synced 2025-05-10 04:50:29 +08:00
SQOOP-972: Sqoop2: Load server URL from environment in shell
(Jarek Jarcec Cecho via Kate Ting)
This commit is contained in:
parent
75ae6e3ea0
commit
a82878bc75
@ -27,6 +27,11 @@ public class Constants {
|
|||||||
public static final String BOLD_STR_SEQUENCE = "@|bold";
|
public static final String BOLD_STR_SEQUENCE = "@|bold";
|
||||||
public static final String END_STR_SEQUENCE = "|@";
|
public static final String END_STR_SEQUENCE = "|@";
|
||||||
|
|
||||||
|
// Environmental variables
|
||||||
|
public static final String ENV_HOST = "SQOOP2_HOST";
|
||||||
|
public static final String ENV_PORT = "SQOOP2_PORT";
|
||||||
|
public static final String ENV_WEBAPP = "SQOOP2_WEBAPP";
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
|
|
||||||
public static final String OPT_XID = "xid";
|
public static final String OPT_XID = "xid";
|
||||||
|
@ -35,9 +35,9 @@ private ShellEnvironment() {
|
|||||||
// using static API.
|
// using static API.
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String serverHost = "localhost";
|
private static String serverHost = getEnv(Constants.ENV_HOST, "localhost");
|
||||||
private static String serverPort = "12000";
|
private static String serverPort = getEnv(Constants.ENV_PORT, "12000");
|
||||||
private static String serverWebapp = "sqoop";
|
private static String serverWebapp = getEnv(Constants.ENV_WEBAPP, "sqoop");
|
||||||
|
|
||||||
private static boolean verbose = false;
|
private static boolean verbose = false;
|
||||||
private static boolean interactive = false;
|
private static boolean interactive = false;
|
||||||
@ -46,6 +46,11 @@ private ShellEnvironment() {
|
|||||||
static SqoopClient client = new SqoopClient(getServerUrl());
|
static SqoopClient client = new SqoopClient(getServerUrl());
|
||||||
static IO io;
|
static IO io;
|
||||||
|
|
||||||
|
public static String getEnv(String variable, String defaultValue) {
|
||||||
|
String value = System.getenv(variable);
|
||||||
|
return value != null ? value : defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
public static SqoopClient getClient() {
|
public static SqoopClient getClient() {
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user