Skip to content

Commit

Permalink
Fixed #1477 Add -n flag to suppress credentials prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel Fontaine committed Jan 31, 2017
1 parent 564f158 commit 40e97af
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ public static void main(String[] args) {
initializeDefaults(properties);
loadConfiguration(properties, args);
overrideConfiguration(properties, args);
promptForCredentialsIfMissing(properties);

if (!isSuppressPrompt(args)) {
promptForCredentialsIfMissing(properties);
}

dumpConfiguration(properties);

loadJdbcDrivers();
Expand Down Expand Up @@ -113,8 +117,16 @@ public static void main(String[] args) {
}

private static boolean isPrintVersionAndExit(String[] args) {
return isFlagSet(args, "-v");
}

private static boolean isSuppressPrompt(String[] args) {
return isFlagSet(args, "-n");
}

private static boolean isFlagSet(String[] args, String flag) {
for (String arg : args) {
if ("-v".equals(arg)) {
if (flag.equals(arg)) {
return true;
}
}
Expand Down Expand Up @@ -257,6 +269,7 @@ private static void printUsage() {
LOG.info("");
LOG.info("Add -X to print debug output");
LOG.info("Add -q to suppress all output, except for errors and warnings");
LOG.info("Add -n to suppress prompting for a user and password");
LOG.info("Add -v to print the Flyway version and exit");
LOG.info("");
LOG.info("Example");
Expand Down

0 comments on commit 40e97af

Please sign in to comment.