From 51b79c874713c3663a345a4651ad65c1f04c8245 Mon Sep 17 00:00:00 2001 From: Vinay Venu Date: Fri, 14 Jun 2024 12:11:37 +0530 Subject: [PATCH] #733 | Remove unnecessary params from application.properties --- .../avni/server/service/MetabaseService.java | 19 +++++++++---------- .../src/main/resources/application.properties | 11 ++++------- .../src/test/resources/application.properties | 4 ++++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/avni-server-api/src/main/java/org/avni/server/service/MetabaseService.java b/avni-server-api/src/main/java/org/avni/server/service/MetabaseService.java index df79dd827..019bc4ea7 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/MetabaseService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/MetabaseService.java @@ -17,17 +17,16 @@ public class MetabaseService { private final MetabaseRepository metabaseRepository; private final OrganisationService organisationService; - @Value("${database.host}") - private String dbHost; + @Value("${avni.database.server}") + private String avniDatabaseServer; - @Value("${database.port}") - private String dbPort; + @Value("${avni.database.port}") + private String avniDatabasePort; - @Value("${database.name}") - private String dbName; + @Value("${avni.database}") + private String avniDatabaseName; - @Value("${database.engine}") - private String dbEngine; + private final String DB_ENGINE = "postgres"; public MetabaseService(MetabaseRepository metabaseRepository, OrganisationService organisationService) { this.metabaseRepository = metabaseRepository; @@ -39,8 +38,8 @@ public void setupMetabase() { String name = currentOrganisation.getName(); String dbUser = currentOrganisation.getDbUser(); - DatabaseDetails databaseDetails = new DatabaseDetails(dbHost, dbPort, dbName, dbUser); - Database database = new Database(name, dbEngine, databaseDetails); + DatabaseDetails databaseDetails = new DatabaseDetails(avniDatabaseServer, avniDatabasePort, avniDatabaseName, dbUser); + Database database = new Database(name, DB_ENGINE, databaseDetails); Collection collection = new Collection(name, name + " collection"); PermissionsGroup permissionsGroup = new PermissionsGroup(name); diff --git a/avni-server-api/src/main/resources/application.properties b/avni-server-api/src/main/resources/application.properties index bc8c44a87..f95d4a6d5 100644 --- a/avni-server-api/src/main/resources/application.properties +++ b/avni-server-api/src/main/resources/application.properties @@ -4,7 +4,8 @@ spring.profiles.active=${OPENCHS_MODE:dev} # Database avni.database=${OPENCHS_DATABASE:openchs} avni.database.port=${OPENCHS_DATABASE_PORT:5432} -spring.datasource.url=${OPENCHS_DATABASE_URL:jdbc:postgresql://localhost:${avni.database.port}/${avni.database}?currentSchema=public} +avni.database.server=${OPENCHS_DATABASE_SERVER:localhost} +spring.datasource.url=${OPENCHS_DATABASE_URL:jdbc:postgresql://${avni.database.server}:${avni.database.port}/${avni.database}?currentSchema=public} spring.datasource.username=${OPENCHS_DATABASE_USER:openchs} spring.datasource.password=${OPENCHS_DATABASE_PASSWORD:password} spring.datasource.driverClassName=org.postgresql.Driver @@ -158,9 +159,5 @@ avni.reportingSystems[2].name=${AVNI_REPORTING_SYSTEM_2_NAME:} avni.reportingSystems[2].url=${AVNI_REPORTING_SYSTEM_2_URL:} #metabase -metabase.api.url=http://localhost:3000/api -database.host=localhost -database.port=5432 -database.name=openchs -database.engine=postgres -metabase.api.key=${METABASE_API_KEY:mb_hwsYP2sFN7fvwM5LTS4d/tnIqA5SeHUxwUhm2KAI1/o=} \ No newline at end of file +metabase.api.url=${METABASE_API_URL:http://localhost:3000/api} +metabase.api.key=${METABASE_API_KEY:mb_hwsYP2sFN7fvwM5LTS4d/tnIqA5SeHUxwUhm2KAI1/o=} diff --git a/avni-server-api/src/test/resources/application.properties b/avni-server-api/src/test/resources/application.properties index c7c8ede13..019c784d6 100644 --- a/avni-server-api/src/test/resources/application.properties +++ b/avni-server-api/src/test/resources/application.properties @@ -118,3 +118,7 @@ csp.allowed.hosts=dummy avni.exception.in.response=true avni.keycloak.avni.publicKeyId=dummy + +#metabase +metabase.api.url=${METABASE_API_URL:http://localhost:3000/api} +metabase.api.key=${METABASE_API_KEY:mb_hwsYP2sFN7fvwM5LTS4d/tnIqA5SeHUxwUhm2KAI1/o=}