From fdbe5ce95c20646cf16bfa6b99073bde7c4d7ce9 Mon Sep 17 00:00:00 2001 From: XP Date: Wed, 28 Aug 2024 14:45:06 -0700 Subject: [PATCH] Fix oracle config --- .../dataapi/datamanager/DataManager.groovy | 3 ++- .../dataapi/persistence/DataPersistence.groovy | 6 ++++++ src/main/resources/application-prodoci.yml | 16 +++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/groovy/gg/xp/xivgear/dataapi/datamanager/DataManager.groovy b/src/main/groovy/gg/xp/xivgear/dataapi/datamanager/DataManager.groovy index e46431f..7bae5af 100644 --- a/src/main/groovy/gg/xp/xivgear/dataapi/datamanager/DataManager.groovy +++ b/src/main/groovy/gg/xp/xivgear/dataapi/datamanager/DataManager.groovy @@ -46,7 +46,7 @@ class DataManager implements AutoCloseable { private static final int maxIlvlFood = 999 - DataManager(DataPersistence pers, JsonConfiguration js) { + DataManager(DataPersistence pers) { this.pers = pers client = new XivApiClient() xivApiUpdater = Thread.startVirtualThread this.&xivApiUpdateLoop @@ -81,6 +81,7 @@ class DataManager implements AutoCloseable { void persistData(FullData newData) { try { + log.info "Persistence: Pushing Data" pers.data = newData } catch (Throwable t) { diff --git a/src/main/groovy/gg/xp/xivgear/dataapi/persistence/DataPersistence.groovy b/src/main/groovy/gg/xp/xivgear/dataapi/persistence/DataPersistence.groovy index 9637d05..fe47069 100644 --- a/src/main/groovy/gg/xp/xivgear/dataapi/persistence/DataPersistence.groovy +++ b/src/main/groovy/gg/xp/xivgear/dataapi/persistence/DataPersistence.groovy @@ -5,6 +5,10 @@ import groovy.util.logging.Slf4j import io.micronaut.core.annotation.Nullable import io.micronaut.objectstorage.ObjectStorageEntry import io.micronaut.objectstorage.ObjectStorageOperations +import io.micronaut.objectstorage.configuration.ObjectStorageConfiguration +import io.micronaut.objectstorage.local.LocalStorageConfiguration +import io.micronaut.objectstorage.oraclecloud.OracleCloudStorageConfiguration +import io.micronaut.objectstorage.oraclecloud.OracleCloudStorageOperations import io.micronaut.objectstorage.request.UploadRequest import jakarta.inject.Singleton @@ -49,6 +53,7 @@ class DataPersistence { void setData(FullData data) { if (data == null) { + log.info "Deleting data" storage.delete key } else { @@ -61,6 +66,7 @@ class DataPersistence { gzipOut.finish() bytes = baos.toByteArray() } + log.info "Uploading data" storage.upload UploadRequest.fromBytes(bytes, key) } } diff --git a/src/main/resources/application-prodoci.yml b/src/main/resources/application-prodoci.yml index 37f9961..9238c07 100644 --- a/src/main/resources/application-prodoci.yml +++ b/src/main/resources/application-prodoci.yml @@ -9,13 +9,19 @@ micronaut: enabled: true bucket: ${OBJECT_STORAGE_BUCKET_NAME:xivgear-data} namespace: ${ORACLE_CLOUD_OBJECT_STORAGE_NAMESPACE:} - region: ${ORACLE_CLOUD_OBJECT_STORAGE_REGION:} compartment-id: ${ORACLE_CLOUD_COMPARTMENT_ID:} auth: - tenant-id: ${ORACLE_CLOUD_TENANT_ID:} - user-id: ${ORACLE_CLOUD_USER_ID:} - fingerprint: ${ORACLE_CLOUD_FINGERPRINT:} - private-key-path: ${ORACLE_CLOUD_PEM_PATH:} local: default: enabled: false + +oci: +# config: +# instance-principal: +# enabled: false + + tenant-id: ${ORACLE_CLOUD_TENANT_ID:} + user-id: ${ORACLE_CLOUD_USER_ID:} + fingerprint: ${ORACLE_CLOUD_FINGERPRINT:} + private-key-file: file:${ORACLE_CLOUD_PEM_PATH:} + region: ${ORACLE_CLOUD_OBJECT_STORAGE_REGION:}