Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions engine/src/main/java/com/arcadedb/GlobalConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ public Object call(final Object value) {
"Password for root user to use at first startup of the server. Set this to avoid asking the password to the user",
String.class, null),

SERVER_ROOT_PASSWORD_PATH("arcadedb.server.rootPasswordPath", SCOPE.SERVER,
"Path to file with password for root user to use at first startup of the server. Set this to avoid asking the password to the user",
String.class, null),

SERVER_MODE("arcadedb.server.mode", SCOPE.SERVER, "Server mode between 'development', 'test' and 'production'", String.class,
"development", Set.of((Object[]) new String[] { "development", "test", "production" })),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import java.io.*;
import java.nio.file.*;
import java.nio.charset.*;
import java.security.*;
import java.security.spec.*;
Expand Down Expand Up @@ -332,6 +333,19 @@ protected void askForRootPassword() throws IOException {
server.getConfiguration().getValueAsString(GlobalConfiguration.SERVER_ROOT_PASSWORD) :
GlobalConfiguration.SERVER_ROOT_PASSWORD.getValueAsString();

if (rootPassword == null) {
final String rootPasswordPath = server != null ?
server.getConfiguration().getValueAsString(GlobalConfiguration.SERVER_ROOT_PASSWORD_PATH) :
GlobalConfiguration.SERVER_ROOT_PASSWORD_PATH.getValueAsString();

if (rootPasswordPath != null) {
if (Files.isReadable(Paths.get(rootPasswordPath)))
rootPassword = Files.readString(Paths.get(rootPasswordPath));
else
throw new ServerSecurityException("Error reading password file at path '" + rootPasswordPath + "'");
}
}

if (rootPassword == null) {
if (server != null ?
server.getConfiguration().getValueAsBoolean(GlobalConfiguration.HA_K8S) :
Expand Down