Skip to content

Commit

Permalink
fix(katzencore): Fixed Option Loading in Client Driver
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlkatze committed Jul 23, 2024
1 parent 4057730 commit 895e075
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/runtime/storage/StorageManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,19 @@ export const useContentStorage = async (_runtimeConfig: RuntimeConfig): Promise<
}

let driver: Driver
const copiedOptions = JSON.parse(JSON.stringify(runtimeConfig.storage.options))
try {
const nitroPackImport = module as DynamicNitroPackImport
driver = nitroPackImport(runtimeConfig.storage.options) as Driver
driver = nitroPackImport(copiedOptions) as Driver
}
catch (e) {
catch (e1) {
try {
const moduleImport = module as DynamicModuleImport
driver = moduleImport.default(runtimeConfig.storage.options) as Driver
driver = moduleImport.default(copiedOptions) as Driver
}
catch (e) {
throw new Error(`Driver ${runtimeConfig.storage.type} could not be imported`)
catch (e2) {
console.log('\x1B[41m\x1B[30m !Katze \x1B[0m Have you installed the driver for the storage type? Consult the unstorage documentation for more information')
throw new Error(`Driver ${runtimeConfig.storage.type} could not be imported, possible error: ${e1}, ${e2}`)
}
}

Expand Down

0 comments on commit 895e075

Please sign in to comment.