diff --git a/packages/backend/src/CoreModule.js b/packages/backend/src/CoreModule.js index dc8fbb9ea..c04d6ae68 100644 --- a/packages/backend/src/CoreModule.js +++ b/packages/backend/src/CoreModule.js @@ -292,6 +292,9 @@ const install = async ({ services, app, useapi }) => { const { PermissionAPIService } = require('./services/PermissionAPIService'); services.registerService('__permission-api', PermissionAPIService); + + const { MountpointService } = require('./services/MountpointService'); + services.registerService('mountpoint', MountpointService); } const install_legacy = async ({ services }) => { diff --git a/packages/backend/src/filesystem/ll_operations/ll_write.js b/packages/backend/src/filesystem/ll_operations/ll_write.js index fc4359a21..cc83a7f15 100644 --- a/packages/backend/src/filesystem/ll_operations/ll_write.js +++ b/packages/backend/src/filesystem/ll_operations/ll_write.js @@ -49,7 +49,8 @@ class LLWriteBase extends LLFilesystemOperation { const errors = svc.get('error-service').create(log); const svc_event = svc.get('event'); - const storage = Context.get('storage'); + const svc_mountpoint = svc.get('mountpoint'); + const storage = svc_mountpoint.get_storage(); bucket ??= config.s3_bucket; bucket_region ??= config.s3_region; diff --git a/packages/backend/src/helpers.js b/packages/backend/src/helpers.js index 575632ff3..8205bb14a 100644 --- a/packages/backend/src/helpers.js +++ b/packages/backend/src/helpers.js @@ -1057,7 +1057,9 @@ async function deleteUser(user_id){ for(let i=0; i ({ ...o }); + +const BaseService = require("./BaseService"); + +/** + * This will eventually be a service which manages the storage + * backends for mountpoints. + * + * For the moment, this is a way to access the storage backend + * in situations where ContextInitService isn't able to + * initialize a context. + */ +class MountpointService extends BaseService { + async _init () { + // this.mountpoints_ = {}; + + // Temporary solution - we'll develop this incrementally + this.storage_ = null; + } + + // Temporary solution - we'll develop this incrementally + set_storage (storage) { + this.storage_ = storage; + } + get_storage () { + return this.storage_; + } +} + +module.exports = { + MountpointService, +};