-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(server): add external kvp natives #3404
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
Conversation
I'd prefer to have the key value db isolated on the server. Maybe there is a better way to have specific keys available between different resources. But right now best way is to only have one resource that writes that specific key. |
The implementation is the same as the client though. Without this I need to trigger events with callbacks to another resource that people might not have and the callback is never returned. Same happens with exports. This change simplifies it. These are getters don't see what harm can it do. Thanks for the review ofc. |
With isolation I mean that no other resource can read the key from another resource on the server. Because the key is prefixed with the resource name this is not possible currently with the other kv getters. With your change a resource could not know which other resources access the data. When a resource stores sensitive data inside the key value db this data could be grabbed from any resource. |
So perhaps a new variable on the setters to flag that kvp as allowed to be read by other resources? |
I'm a bit confused by your statement of |
trigger an event that doesnt exist and check when that callback is returned you will have your answer. |
exports will also error when they dont exist. Not adding this because we dont want to allow other scripts getting data from other scripts its not a valid reason in my opinion, because its no different saving to a mysql database. I would then save the same very data to a database and fecth it anyways from any resource, so why should KVP be any different... |
Could be getting a bit off the trail here, but if you're having concerns with erroring exports on missing resources, couldn't using a pcall in your code fix your issue? And with events, some form of timeout function with a return value? |
@FabianTerhorst what if we tied this to the https://docs.fivem.net/docs/developers/sandbox/#permission-system |
Thanks for your efforts. |
Goal of this PR
Add external KVP natives to the server, matching the client-side implementation. This is useful for enabling communication between resources on the server.
How is this PR achieving the goal
Aligns the server with client KVP natives by implementing the same functionality server-side.
This PR applies to the following area(s)
Server
Successfully tested on
Game builds: ..
Platforms: Windows, Linux
windows
Checklist
Fixes issues