Skip to content

Commit

Permalink
✨ : add GOOGLE_PROJECT to google credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Aug 18, 2020
1 parent 36fa29b commit cc16b32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,21 @@
<b-form-textarea
v-model="credentials.serviceAccountJSONContents"
:state="notEmpty(credentials.serviceAccountJSONContents)"
rows="10"
/>
</b-input-group>
<b-form-invalid-feedback>This field is mandatory</b-form-invalid-feedback>
</b-form-group>

<b-form-group
label="Project"
description="Your GCP Project id (GOOGLE_PROJECT)"
>
<b-input
id="credentials.projectId"
v-model="credentials.projectId"
/>
</b-form-group>
</div>
</template>

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/gaia_app/credentials/Credentials.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ data class AWSCredentials(var accessKey:String, var secretKey:String):Credential
}

@Document
data class GoogleCredentials(var serviceAccountJSONContents:String):Credentials("google") {
override fun toEnv() = listOf("GOOGLE_CREDENTIALS=$serviceAccountJSONContents")
data class GoogleCredentials(var serviceAccountJSONContents:String, var projectId:String? = null):Credentials("google") {
override fun toEnv() = listOf("GOOGLE_CREDENTIALS=$serviceAccountJSONContents", "GOOGLE_PROJECT=$projectId")
}

@Document
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/io/gaia_app/credentials/CredentialsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ internal class CredentialsTest {
}

@Test
fun `toEnv() for GoogleCredentials should return GOOGLE_CREDENTIALS`() {
assertThat(GoogleCredentials("jsonContent").toEnv())
.containsExactly("GOOGLE_CREDENTIALS=jsonContent")
fun `toEnv() for GoogleCredentials should return GOOGLE_CREDENTIALS and GOOGLE_PROJECT`() {
assertThat(GoogleCredentials("jsonContent", "projectId").toEnv())
.containsExactly("GOOGLE_CREDENTIALS=jsonContent", "GOOGLE_PROJECT=projectId")
}
}

0 comments on commit cc16b32

Please sign in to comment.