Skip to content

Commit

Permalink
Merge pull request #171 from COS301-SE-2023/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MrME-CodeSmith authored Oct 22, 2023
2 parents ca57c31 + 008b5e1 commit fb83168
Show file tree
Hide file tree
Showing 34 changed files with 506 additions and 330 deletions.
80 changes: 40 additions & 40 deletions .github/workflows/main2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@ jobs:

- name: Create .env
run: |
echo KOJA_AWS_RDS_DATABASE_URL=${{ secrets.KOJA_AWS_RDS_DATABASE_URL }} >> client/assets/.env
echo KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME }} >> client/assets/.env
echo KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD }} >> client/assets/.env
echo KOJA_AWS_DYNAMODB_ACCESS_KEY_ID=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_ID }} >> client/assets/.env
echo KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET }} >> client/assets/.env
echo GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} >> client/assets/.env
echo GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} >> client/assets/.env
echo KOJA_JWT_SECRET=${{ secrets.KOJA_JWT_SECRET }} >> client/assets/.env
echo API_KEY=${{ secrets.API_KEY }} >> client/assets/.env
echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} >> client/assets/.env
echo KOJA_ID_SECRET=${{ secrets.KOJA_ID_SECRET }} >> client/assets/.env
echo COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} >> client/assets/.env
echo KOJA_PRIVATE_KEY_PASS=${{ secrets.KOJA_PRIVATE_KEY_PASS }} >> client/assets/.env
echo KOJA_PRIVATE_KEY_SALT=${{ secrets.KOJA_PRIVATE_KEY_SALT }} >> client/assets/.env
echo AI_PRIVATE_KEY_PASS=${{ secrets.AI_PRIVATE_KEY_PASS }} >> client/assets/.env
echo AI_PRIVATE_KEY_SALT=${{ secrets.AI_PRIVATE_KEY_SALT }} >> client/assets/.env
echo SERVER_ADDRESS=${{ secrets.SERVER_ADDRESS }} >> client/assets/.env
echo SERVER_PORT=${{ secrets.SERVER_PORT }} >> client/assets/.env
echo koja_aws_rds_database_url=${{ secrets.KOJA_AWS_RDS_DATABASE_URL }} >> client/assets/.env
echo koja_aws_rds_database_admin_username=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME }} >> client/assets/.env
echo koja_aws_rds_database_admin_password=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD }} >> client/assets/.env
echo koja_aws_dynamodb_access_key_id=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_ID }} >> client/assets/.env
echo koja_aws_dynamodb_access_key_secret=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET }} >> client/assets/.env
echo koja_google_client_id=${{ secrets.GOOGLE_CLIENT_ID }} >> client/assets/.env
echo koja_google_client_secret=${{ secrets.GOOGLE_CLIENT_SECRET }} >> client/assets/.env
echo koja_jwt_secret=${{ secrets.KOJA_JWT_SECRET }} >> client/assets/.env
echo koja_google_maps_api_key=${{ secrets.GOOGLE_MAPS_API_KEY }} >> client/assets/.env
echo koja_openai_api_key=${{ secrets.OPENAI_API_KEY }} >> client/assets/.env
echo koja_id_secret=${{ secrets.KOJA_ID_SECRET }} >> client/assets/.env
echo koja_coveralls_repo_token=${{ secrets.COVERALLS_REPO_TOKEN }} >> client/assets/.env
echo koja_private_key_password=${{ secrets.KOJA_PRIVATE_KEY_PASS }} >> client/assets/.env
echo koja_private_key_salt=${{ secrets.KOJA_PRIVATE_KEY_SALT }} >> client/assets/.env
echo koja_ai_private_key_password=${{ secrets.AI_PRIVATE_KEY_PASS }} >> client/assets/.env
echo koja_ai_private_key_salt=${{ secrets.AI_PRIVATE_KEY_SALT }} >> client/assets/.env
echo koja_server_address=${{ secrets.SERVER_ADDRESS }} >> client/assets/.env
echo koja_server_port=${{ secrets.SERVER_PORT }} >> client/assets/.env
- name: Set up Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: '3.10'

- name: Install Flutter dependencies
run: flutter pub get
working-directory: client

- name: Run Flutter linter
run: flutter analyze
working-directory: client
Expand All @@ -71,30 +71,30 @@ jobs:

- name: Create .env
run: |
echo KOJA_AWS_RDS_DATABASE_URL=${{ secrets.KOJA_AWS_RDS_DATABASE_URL }} >> .env
echo KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME }} >> .env
echo KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD }} >> .env
echo KOJA_AWS_DYNAMODB_ACCESS_KEY_ID=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_ID }} >> .env
echo KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET }} >> .env
echo GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} >> .env
echo GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} >> .env
echo KOJA_JWT_SECRET=${{ secrets.KOJA_JWT_SECRET }} >> .env
echo API_KEY=${{ secrets.API_KEY }} >> .env
echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} >> .env
echo KOJA_ID_SECRET=${{ secrets.KOJA_ID_SECRET }} >> .env
echo COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} >> .env
echo KOJA_PRIVATE_KEY_PASS=${{ secrets.KOJA_PRIVATE_KEY_PASS }} >> .env
echo KOJA_PRIVATE_KEY_SALT=${{ secrets.KOJA_PRIVATE_KEY_SALT }} >> .env
echo AI_PRIVATE_KEY_PASS=${{ secrets.AI_PRIVATE_KEY_PASS }} >> .env
echo AI_PRIVATE_KEY_SALT=${{ secrets.AI_PRIVATE_KEY_SALT }} >> .env
echo SERVER_ADDRESS=${{ secrets.SERVER_ADDRESS }} >> .env
echo SERVER_PORT=${{ secrets.SERVER_PORT }} >> .env
echo koja_aws_rds_database_url=${{ secrets.KOJA_AWS_RDS_DATABASE_URL }} >> .env
echo koja_aws_rds_database_admin_username=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME }} >> .env
echo koja_aws_rds_database_admin_password=${{ secrets.KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD }} >> .env
echo koja_aws_dynamodb_access_key_id=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_ID }} >> .env
echo koja_aws_dynamodb_access_key_secret=${{ secrets.KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET }} >> .env
echo koja_google_client_id=${{ secrets.GOOGLE_CLIENT_ID }} >> .env
echo koja_google_client_secret=${{ secrets.GOOGLE_CLIENT_SECRET }} >> .env
echo koja_jwt_secret=${{ secrets.KOJA_JWT_SECRET }} >> .env
echo koja_google_maps_api_key=${{ secrets.GOOGLE_MAPS_API_KEY }} >> .env
echo koja_openai_api_key=${{ secrets.OPENAI_API_KEY }} >> .env
echo koja_id_secret=${{ secrets.KOJA_ID_SECRET }} >> .env
echo koja_coveralls_repo_token=${{ secrets.COVERALLS_REPO_TOKEN }} >> .env
echo koja_private_key_password=${{ secrets.KOJA_PRIVATE_KEY_PASS }} >> .env
echo koja_private_key_salt=${{ secrets.KOJA_PRIVATE_KEY_SALT }} >> .env
echo koja_ai_private_key_password=${{ secrets.AI_PRIVATE_KEY_PASS }} >> .env
echo koja_ai_private_key_salt=${{ secrets.AI_PRIVATE_KEY_SALT }} >> .env
echo koja_server_address=${{ secrets.SERVER_ADDRESS }} >> .env
echo koja_server_port=${{ secrets.SERVER_PORT }} >> .env
- name: Run Linter
run: ./gradlew ktlintCheck

- name: Run Tests
run: ./gradlew test

- name: Build Spring Boot project
run: ./gradlew build -x test -x check
run: ./gradlew build -x test -x check
20 changes: 2 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,8 @@ WORKDIR /app
COPY --from=builder /home/gradle/project/build/libs/ /app/

# Create .env file based on the environment variables of the environment where the Dockerfile is being built
RUN echo "KOJA_AWS_RDS_DATABASE_URL=$KOJA_AWS_RDS_DATABASE_URL" >> .env && \
echo "KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME=$KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME" >> .env && \
echo "KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD=$KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD" >> .env && \
echo "KOJA_AWS_DYNAMODB_ACCESS_KEY_ID=$KOJA_AWS_DYNAMODB_ACCESS_KEY_ID" >> .env && \
echo "KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET=$KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET" >> .env && \
echo "GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID" >> .env && \
echo "GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET" >> .env && \
echo "KOJA_JWT_SECRET=$KOJA_JWT_SECRET" >> .env && \
echo "KOJA_ID_SECRET=$KOJA_AI_SECRET" >> .env && \
echo "API_KEY=$API_KEY" >> .env && \
echo "OPENAI_API_KEY=$OPENAI_API_KEY" >> .env && \
echo "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env && \
echo "KOJA_PRIVATE_KEY_PASS=$KOJA_PRIVATE_KEY_PASS" >> .env && \
echo "KOJA_PRIVATE_KEY_SALT=$KOJA_PRIVATE_KEY_SALT" >> .env && \
echo "AI_PRIVATE_KEY_PASS=$AI_PRIVATE_KEY_PASS" >> .env && \
echo "AI_PRIVATE_KEY_SALT=$AI_PRIVATE_KEY_SALT" >> .env && \
echo "SERVER_ADDRESS=$SERVER_ADDRESS" >> .env && \
echo "SERVER_PORT=$SERVER_PORT" >> .env
RUN echo "koja_server_address=$koja_server_address" >> .env && \
echo "koja_server_port=$koja_server_port" >> .env


# Start the built spring boot project when the Docker container is started
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2")
implementation("software.amazon.awssdk:dynamodb:2.20.115")
implementation("org.bouncycastle:bcprov-jdk15on:1.68")

implementation("com.google.cloud:google-cloud-secretmanager:2.28.0")
implementation(kotlin("stdlib-jdk8"))
}

Expand Down
4 changes: 2 additions & 2 deletions client/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ SPEC CHECKSUMS:
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
fl_location: 68b4a6c4aad2a453493ff66f196e0748280cf43e
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721
flutter_inappwebview: acd4fc0f012cefd09015000c241137d82f01ba62
flutter_pdfview: 25f53dd6097661e6395b17de506e6060585946bd
flutter_web_auth_2: a1bc00762c408a8f80b72a538cd7ff5b601c3e71
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
Expand All @@ -138,4 +138,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
2 changes: 1 addition & 1 deletion client/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 4 additions & 2 deletions client/lib/Utils/constants_util.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';

final String apiKey = dotenv.env['API_KEY'] ?? "";
final String serverAddress = dotenv.env['SERVER_ADDRESS'] ?? "";
import 'environment_variable_constants.dart';

final String apiKey = dotenv.env[EnvironmentVariableConstant.googleMapsApiKey] ?? "";
final String serverAddress = dotenv.env[EnvironmentVariableConstant.serverAddress] ?? "";
const darkBlue = Color(0xFF1976D2);

/// This store the list of locations
Expand Down
20 changes: 20 additions & 0 deletions client/lib/Utils/environment_variable_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class EnvironmentVariableConstant {
static const String kojaAwsRdsDatabaseUrl = "KOJA_AWS_RDS_DATABASE_URL";
static const String kojaAwsRdsDatabaseAdminUsername = "KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME";
static const String kojaAwsRdsDatabaseAdminPassword = "KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD";
static const String kojaAwsDynamodbAccessKeyId = "KOJA_AWS_DYNAMODB_ACCESS_KEY_ID";
static const String kojaAwsDynamodbAccessKeySecret = "KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET";
static const String googleClientId = "GOOGLE_CLIENT_ID";
static const String googleClientSecret = "GOOGLE_CLIENT_SECRET";
static const String googleMapsApiKey = "GOOGLE_MAPS_API_KEY";
static const String kojaJwtSecret = "KOJA_JWT_SECRET";
static const String openaiApiKey = "OPENAI_API_KEY";
static const String kojaIdSecret = "KOJA_ID_SECRET";
static const String coverallsRepoToken = "COVERALLS_REPO_TOKEN";
static const String kojaPrivateKeyPass = "KOJA_PRIVATE_KEY_PASS";
static const String kojaPrivateKeySalt = "KOJA_PRIVATE_KEY_SALT";
static const String aiPrivateKeyPass = "AI_PRIVATE_KEY_PASS";
static const String aiPrivateKeySalt = "AI_PRIVATE_KEY_SALT";
static const String serverAddress = "SERVER_ADDRESS";
static const String serverPort = "SERVER_PORT";
}
5 changes: 3 additions & 2 deletions client/lib/providers/service_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:convert';
import 'dart:io';

import 'package:flutter/services.dart';
import 'package:koja/Utils/environment_variable_constants.dart';
import 'package:koja/models/user_time_boundary_model.dart';
import 'package:koja/providers/context_provider.dart';
import 'package:flutter/foundation.dart';
Expand Down Expand Up @@ -57,8 +58,8 @@ class ServiceProvider with ChangeNotifier {

Future<ServiceProvider> init() async {
startLocationListner();
_serverAddress = dotenv.get("SERVER_ADDRESS", fallback: "10.0.2.2");
_serverPort = dotenv.get("SERVER_PORT", fallback: "8080");
_serverAddress = dotenv.get(EnvironmentVariableConstant.serverAddress, fallback: "10.0.2.2");
_serverPort = dotenv.get(EnvironmentVariableConstant.serverPort, fallback: "8080");
return this;
}

Expand Down
34 changes: 21 additions & 13 deletions client/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
url: "https://pub.dev"
source: hosted
version: "1.17.1"
version: "1.17.2"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -707,18 +707,18 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
url: "https://pub.dev"
source: hosted
version: "0.12.15"
version: "0.12.16"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted
version: "0.2.0"
version: "0.5.0"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -1016,10 +1016,10 @@ packages:
dependency: transitive
description:
name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
sqflite:
dependency: transitive
description:
Expand Down Expand Up @@ -1128,10 +1128,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.6.0"
time_duration_picker:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1312,10 +1312,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f6deed8ed625c52864792459709183da231ebf66ff0cf09e69b573227c377efe
sha256: c620a6f783fa22436da68e42db7ebbf18b8c44b9a46ab911f666ff09ffd9153f
url: "https://pub.dev"
source: hosted
version: "11.3.0"
version: "11.7.1"
watcher:
dependency: transitive
description:
Expand All @@ -1324,6 +1324,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
web:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
web_socket_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -1389,5 +1397,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.0.0 <4.0.0"
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.10.0"
41 changes: 18 additions & 23 deletions src/main/kotlin/com/teamcaffeine/koja/KojaApplication.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.teamcaffeine.koja

import com.google.cloud.secretmanager.v1.SecretManagerServiceClient
import com.google.cloud.secretmanager.v1.SecretVersionName
import com.teamcaffeine.koja.constants.EnvironmentVariableConstant
import io.github.cdimascio.dotenv.Dotenv
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
Expand All @@ -9,33 +12,25 @@ import java.lang.System.setProperty
@SpringBootApplication(exclude = [SecurityAutoConfiguration::class])
class KojaApplication

fun main(args: Array<String>) {
val dotenv: Dotenv = Dotenv.load()
const val envSecretVersion = "latest"
const val projectId = "koja-401505"

setProperty("KOJA_AWS_RDS_DATABASE_URL", dotenv["KOJA_AWS_RDS_DATABASE_URL"]!!)
setProperty("KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME", dotenv["KOJA_AWS_RDS_DATABASE_ADMIN_USERNAME"]!!)
setProperty("KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD", dotenv["KOJA_AWS_RDS_DATABASE_ADMIN_PASSWORD"]!!)
setProperty("KOJA_AWS_DYNAMODB_ACCESS_KEY_ID", dotenv["KOJA_AWS_DYNAMODB_ACCESS_KEY_ID"]!!)
setProperty("KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET", dotenv["KOJA_AWS_DYNAMODB_ACCESS_KEY_SECRET"]!!)
setProperty("OPENAI_API_KEY", dotenv["OPENAI_API_KEY"]!!)
setProperty("SERVER_ADDRESS", dotenv["SERVER_ADDRESS"]!!)
if (dotenv["SERVER_PORT"] != null) {
setProperty("SERVER_PORT", dotenv["SERVER_PORT"]!!)
} else {
setProperty("SERVER_PORT", "")
fun getSecret(projectId: String, secretId: String, versionId: String): String {
SecretManagerServiceClient.create().use { client ->
val secretVersionName = SecretVersionName.of(projectId, secretId, versionId)
val response = client.accessSecretVersion(secretVersionName)
return response.payload.data.toStringUtf8()
}
}

// Set Google Sign In client ID and client secret properties
setProperty("GOOGLE_CLIENT_ID", dotenv["GOOGLE_CLIENT_ID"]!!)
setProperty("GOOGLE_CLIENT_SECRET", dotenv["GOOGLE_CLIENT_SECRET"]!!)
setProperty("API_KEY", dotenv["API_KEY"]!!)

// Set JWT secret key property
setProperty("KOJA_JWT_SECRET", dotenv["KOJA_JWT_SECRET"]!!)
setProperty("KOJA_ID_SECRET", dotenv["KOJA_ID_SECRET"]!!)
fun main(args: Array<String>) {
val dotenv: Dotenv = Dotenv.load()

setProperty("KOJA_PRIVATE_KEY_PASS", dotenv["KOJA_PRIVATE_KEY_PASS"]!!)
setProperty("KOJA_PRIVATE_KEY_SALT", dotenv["KOJA_PRIVATE_KEY_SALT"]!!)
EnvironmentVariableConstant.asMap.forEach { (_, secretName) ->
val valueFromEnv = dotenv[secretName]
val finalValue = valueFromEnv ?: getSecret(projectId, secretName, envSecretVersion)
setProperty(secretName, finalValue)
}

runApplication<KojaApplication>(*args)
}
Loading

0 comments on commit fb83168

Please sign in to comment.