keyshade-xyz / keyshade

Realtime secret and configuration management tool, with the best in class security and seamless integration support
https://keyshade.xyz
Mozilla Public License 2.0
196 stars 96 forks source link

API: Update the functionality by which slugs are generated for entities #416

Closed rajdip-b closed 2 weeks ago

rajdip-b commented 3 weeks ago

Description

Slugs are associated to the following entities:

Whenever any of these entities are created, we associate a slug to it. The slug is based upon the name of the entity. Similarly, if the name is updated, we update the slug aswell.

Here is the code that is responsible for the same: https://github.com/keyshade-xyz/keyshade/blob/89e2fccc390771c925ea9d1c4ede8270ec6e5a80/apps/api/src/common/slug-generator.ts#L11-L25

Right now, it generates a slug based out of these conditions:

What we want to do is, update the way the charset is associated. Ideally, instead of generating the charset randomly, we would like to increment it based upon existing knowledge.

Solution

Let's say you have been given a variable named PORT. We would like to save the name using this format: name-<incremental charset>.

Essentially what this means it, we might have a number of variables across different projects that might be named PORT but we want to identify each PORT variable by its slug uniquely. So, this pattern would create multiple slugs in the following format: port-0, ..., port-9, port-a, ... port-z, port-00, ... and so on.

Additional context

Refer to #415 to understand how slugs were implemented

Nil2000 commented 3 weeks ago

Since the slug check is dependent upon entityType, we need to generateSlug specific to each entityType. Is it? Correct me if I am wrong

rajdip-b commented 3 weeks ago

https://github.com/keyshade-xyz/keyshade/blob/edfbce068dc0c3d23a92ce3a9d69c06f8457b7d8/apps/api/src/common/slug-generator.ts#L92

If you take a look in this function, you would find that the only dependency on the entity type is to check for uniqueness, and not for naming convention. Also, that check is already in place. You would just need to update the generateSlug method. Hope that makes sense

Prakhargarg-2010196 commented 2 weeks ago

Hi,has this issue been already picked up? I am new to open-source and would like to take it up if possible ?

rajdip-b commented 2 weeks ago

Hey, unfortunately no, the issue is already picked up. And the PR is nearly done. Can you please pick some other issues?

Prakhargarg-2010196 commented 2 weeks ago

Okay let me see if there is some other issue i can deal with. Thanks for quick response.

rajdip-b commented 2 weeks ago

:tada: This issue has been resolved in version 2.5.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: