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

Feat: Add env support to remove hardcoding the prod urls #1144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seriouslysean
Copy link
Collaborator

Issue number

Relevant issue number

  • Resolves #

Please check the following

  • Do the tests still pass? (see Run the Tests)
  • Is the code formatted properly? (see Linting (Formatting))
  • For New Features:
    • Have tests been added to cover any new features or fixes?
    • Has the documentation been updated accordingly?

Please describe additional details for testing this change

@seriouslysean seriouslysean added enhancement New feature or request version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1) labels Jan 3, 2025
@seriouslysean seriouslysean self-assigned this Jan 3, 2025
@@ -4,28 +4,28 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="%VITE_APP_URL%/favicon.ico" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Haviles04 I'm looking at you, shame! You hardcoded all these productions urls, hahaha. @itsalaidbacklife we should get rid of these and switch to this env method. @jerryh-jr will need it in his unhead PR anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, Mal did it here, 7826a83, but no one fixed it hahahaha.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it this is using ejs variable substitution, right? Where is this exact syntax coming from, and why does it not require reference to either process.env or meta.import to access the env var?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean touché but given that we have 4 different tools for rendering dynamic html between Vue, vite, sails and ejs, it's not always clear which docs to read when seeing a new templating syntax 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

puts hands up it wasn't me!

@@ -1,3 +1,4 @@
VITE_APP_URL=http://localhost:8080
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably missed some, someone really double check me. @Haviles04 @itsalaidbacklife

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional files using localhost:

  • vite.config.mjs
  • config/env/staging.js

Places I'm unsure whether we want to change the hard coded references:

  • tests - I'd think we want to keep the tests commands e.g. rankedMatches.spec.js to use localhost in cy.request() to avoid accidentally testing against prod and generating bs data
  • src/plugins/sails.js - fallback in case of missing env; seems reasonable to keep it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not change HOST_SERVER_URL in vite.config as it's used for the docker version, and server only. Same for config/env/staging.js, they should stay hardcoded since it's based on hard url location. I also think tests are fine staying hardcoded for that same reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants