Skip to content
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

Adds environment variable for Single Redis Instance #141

Closed
christianhelp opened this issue Nov 26, 2024 — with Linear · 1 comment · Fixed by #155
Closed

Adds environment variable for Single Redis Instance #141

christianhelp opened this issue Nov 26, 2024 — with Linear · 1 comment · Fixed by #155
Assignees
Labels
enhancement New feature or request

Comments

Copy link
Collaborator

Description

  • The current setup for how our Redis (AKA Vercel KV) is that a key is set solely by its name. This name does not change between development / preview environments. For example, a key setting function currently looks await kv.sadd("config:navitemslist", encodeURIComponent(name)).
  • Because of this, the current set up requires anyone who wishes to use Hackkit to have two separate instances: one for development and one for production. This creates a more difficult developer experience especially for those on free plans. This issue can easily be solved by prepending an environment variable that changes between environments to keep all of the keys in one database.

Requirements

  • Create an environment variable called HK_ENV that allows for it to be set to "development" or "production" depending on the environment.
  • Ensure this ENV is a part of the turbo.json under the globalEnv value so people using Hackkit will know that it is a required key
  • Append the key to the redis calls so it will look something like the following

Screenshot_2024-11-21_at_15.46.41.png

Notice that there is also an underscore that separates the env value from the key itself. The underscore was arbitrary and could also be something like a '-'. Up to developer discretion.

@christianhelp christianhelp added the enhancement New feature or request label Nov 26, 2024 — with Linear
Copy link

linear bot commented Nov 26, 2024

@christianhelp christianhelp changed the title Prepend an environment variable allowing for a single Redis instance Allows for Single Redis Instance Nov 26, 2024
@christianhelp christianhelp changed the title Allows for Single Redis Instance Adds environment variable for Single Redis Instance Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants