From 186aa7e47be85ea4ac9eccbbe74a40d4e3bb659e Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 9 Mar 2021 15:17:02 +0100 Subject: [PATCH] Fixed saving service account --- flank-scripts/build.gradle.kts | 2 +- .../flank/scripts/ops/firebase/SaveServiceAccount.kt | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/flank-scripts/build.gradle.kts b/flank-scripts/build.gradle.kts index 9456756481..6070cb0612 100644 --- a/flank-scripts/build.gradle.kts +++ b/flank-scripts/build.gradle.kts @@ -26,7 +26,7 @@ shadowJar.apply { } } // .. -version = "1.9.0" +version = "1.9.1" group = "com.github.flank" application { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/SaveServiceAccount.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/SaveServiceAccount.kt index c276fb6de0..2b8a58dcbb 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/SaveServiceAccount.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/SaveServiceAccount.kt @@ -8,10 +8,13 @@ import java.nio.file.Path fun saveServiceAccount( serviceAccount: String, serviceAccountPath: Path = defaultCredentialPath.toAbsolutePath() -) = when { - serviceAccount.startsWith("http", true) -> downloadFile(serviceAccount, serviceAccountPath) - serviceAccount.endsWith(".json", true) -> saveFromFile(serviceAccount, serviceAccountPath) - else -> saveFromStr(serviceAccount, serviceAccountPath) +) { + serviceAccountPath.parent.toFile().mkdirs() + when { + serviceAccount.startsWith("http", true) -> downloadFile(serviceAccount, serviceAccountPath) + serviceAccount.endsWith(".json", true) -> saveFromFile(serviceAccount, serviceAccountPath) + else -> saveFromStr(serviceAccount, serviceAccountPath) + } } private fun saveFromFile(