parent
b4281468d0
commit
e3d294e988
2 changed files with 12 additions and 12 deletions
|
@ -28,22 +28,16 @@ public abstract class AbstractExportImportCommand extends AbstractStartCommand i
|
||||||
|
|
||||||
@Option(names = "--dir",
|
@Option(names = "--dir",
|
||||||
arity = "1",
|
arity = "1",
|
||||||
description = "Set the path to a directory where files will be created with the exported data.",
|
description = "Set the path to a directory where files will be read from when importing or created with the exported data.",
|
||||||
paramLabel = "<path>")
|
paramLabel = "<path>")
|
||||||
String toDir;
|
String toDir;
|
||||||
|
|
||||||
@Option(names = "--file",
|
@Option(names = "--file",
|
||||||
arity = "1",
|
arity = "1",
|
||||||
description = "Set the path to a file that will be created with the exported data.",
|
description = "Set the path to a file that will be read when importing or created with the exported data.",
|
||||||
paramLabel = "<path>")
|
paramLabel = "<path>")
|
||||||
String toFile;
|
String toFile;
|
||||||
|
|
||||||
@Option(names = "--realm",
|
|
||||||
arity = "1",
|
|
||||||
description = "Set the name of the realm to export",
|
|
||||||
paramLabel = "<realm>")
|
|
||||||
String realm;
|
|
||||||
|
|
||||||
protected AbstractExportImportCommand(String action) {
|
protected AbstractExportImportCommand(String action) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
@ -62,10 +56,6 @@ public abstract class AbstractExportImportCommand extends AbstractStartCommand i
|
||||||
executionError(spec.commandLine(), "Must specify either --dir or --file options.");
|
executionError(spec.commandLine(), "Must specify either --dir or --file options.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (realm != null) {
|
|
||||||
System.setProperty("keycloak.migration.realmName", realm);
|
|
||||||
}
|
|
||||||
|
|
||||||
Environment.setProfile(Environment.IMPORT_EXPORT_MODE);
|
Environment.setProfile(Environment.IMPORT_EXPORT_MODE);
|
||||||
|
|
||||||
super.run();
|
super.run();
|
||||||
|
|
|
@ -41,12 +41,22 @@ public final class Export extends AbstractExportImportCommand implements Runnabl
|
||||||
defaultValue = "50")
|
defaultValue = "50")
|
||||||
Integer usersPerFile;
|
Integer usersPerFile;
|
||||||
|
|
||||||
|
@Option(names = "--realm",
|
||||||
|
arity = "1",
|
||||||
|
description = "Set the name of the realm to export",
|
||||||
|
paramLabel = "<realm>")
|
||||||
|
String realm;
|
||||||
|
|
||||||
public Export() {
|
public Export() {
|
||||||
super(ACTION_EXPORT);
|
super(ACTION_EXPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doBeforeRun() {
|
protected void doBeforeRun() {
|
||||||
|
if (realm != null) {
|
||||||
|
System.setProperty("keycloak.migration.realmName", realm);
|
||||||
|
}
|
||||||
|
|
||||||
System.setProperty("keycloak.migration.usersExportStrategy", users.toUpperCase());
|
System.setProperty("keycloak.migration.usersExportStrategy", users.toUpperCase());
|
||||||
|
|
||||||
if (usersPerFile != null) {
|
if (usersPerFile != null) {
|
||||||
|
|
Loading…
Reference in a new issue