Skip to content

Commit

Permalink
Handle existing operator_users.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
tvernum committed Jul 4, 2023
1 parent 5768e69 commit 49a8850
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,13 @@ private void configureSecurity() {
if (operators.isEmpty() == false) {
// TODO: Support service accounts here
Path destination = workingDir.resolve("config").resolve("operator_users.yml");
boolean fileExists = Files.exists(destination);
try (Writer writer = Files.newBufferedWriter(destination, StandardOpenOption.CREATE, StandardOpenOption.APPEND)) {
// If the file already exists (the test has its own operator_users file) then don't duplicate the top-level key
if (fileExists == false) {
writer.write("operator:\n");
}
writer.write(String.format(Locale.ROOT, """
operator:
- usernames: [%s]
realm_type: "file"
auth_type: "realm"
Expand Down

0 comments on commit 49a8850

Please sign in to comment.