-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic mount point #42
Comments
This is technically possible, but the APIs are not exposed via any service providers in the current version(s) of the client and server. If you create an issue in the osjs-client as well then I'll try to look at it by this week.
Create a service provider. You could wire it together either via signals (events) or a service contract. class MyServiceProvider {
constructor(core, options = {}) {
this.core = core
this.options = options
}
async init() {
this.core.singleton('my-service', this.createMyContract())
}
createMyContract() {
return {
mount: () => this.createSomeMountpoint()
}
}
createSomeMountpoint() {
// This is where you would add stuff to do actual operations
}
} Then via your apps do |
Which does not have to be an app ofc. And as for conditions, you can create your own state(s) and such and as I mentioned wire it together with events. If you have some idea how you need it to work, then show me and I can write a more complete example. |
Let's consider this scenario. mountpoints: [{
name: 'myMonster',
adapter: 'monster',
attributes: {
endpoint: "http://localhost:12345/auth/v1.0",
}
}, {
name: 'some-name',
adapter: 'monster',
attributes: {
endpoint: "http://somehost:8080/auth/v1.0",
}
}, ... // mountpoints could be more
] This object must be created at runtime as a user logins to OS.js, and a user must could seen his mountpoints and select each one to
Still I didn't write service provider. Of course I think one way may helps: |
With the scenario you just described it sounds like you might not need any runtime dynamic mount/unmount on the client-side, but rather make the login process manipulate the mounpoint list (upon login) that usually comes from the statically generated configuration. As for the server side, since you're using the same adapter for everything, I think a nice way to approach this is to make a mountpoint adapter support RegEx in the I think this solves the issue in a fast and efficient way for your needs -- at least if you know what name(s) you're going to use for your mountpoints. So, to summarize:
|
Sorry Anders, we started new contribution on openstack (tempAuth+keystone) authentication that must completed first. We make new issue to contribute openstack authentication soon!
Actually we need mount users object storage as they login(Now we create mountpoint right after users login, in auth adapter). bellow code do this for us: .
.
.
const projectIds = Object.keys(req.session.swiftAuth.projects);
let fs = core.make('osjs/fs');
projectIds.map (item => {
const name = req.session.swiftAuth.projects[item]['name'];
fs.mountpoints.push({name: name, adapter: 'monster', id:item, attributes:{}});
});
.
.
.
As you said before, we must write serviceProvider to decouple this operation from login and depends it to auth SP. But our new issue is creating client mountpoints to showing user! Do we need create a client service provider for this porpuse? |
This wasn't clear to my why i need modify Filesystem component. what is your mean of |
This was a summary of what would need to be changed in osjs-client with the suggestions I offered. So it would be me that actually does this.
Please use the following issue for client side stuff: os-js/osjs-client#134 In any case, I would recommend creating a service provider for this. Store the data required to set up the mountpoints in the user data, then just use the new methods that will be implemented by os-js/osjs-client#134. The reason for this is that the VFS is not available before after a user has logged in (this can be customized, but I would not recommend it). |
Why did you close this?
…On Sun, Jan 3, 2021, 19:09 SMHashemi ***@***.***> wrote:
Closed #42 <#42>.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#42 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABHODC3ZK6EPGM2ENTMDFDSYCXFLANCNFSM4UGW7P6A>
.
|
Because you tell me on another issue if your issue solved close issue. I think the problem solved.
|
But I don't think this is solved 😄 There still is no proper way to dynamically add/remove mountpoints on the server. Pushing into that array is a very brute force way of doing this, and is not guaranteed to work forever of some internal mechanics change slightly. I wrote here what I feel needs to be done to solve this correctly: #42 (comment) |
I just realized there's a way to dynamically add mountpoints in the server already 😊
I might actually make it so the client also supports using |
If that does not solve your issue, please re-open 😊 |
Hi,
Is it possible to create mountpoint at runtime?
For example, in an application, can I careate a new mountpoint with one of adapters registered before?
server.js:
can we do something like this?
{....core.configuration.mountpoints, newMountpoint}
and using it as mountpoints list in application. or just create an mountpoint entry and use it:an then use
mountpoint
. for creating mountpoint in application.Also How can I do this independent of an application. creating
mountpoint
at osjs run time under some condition, and accessing it in whole osjs.The text was updated successfully, but these errors were encountered: