Skip to content

Commit

Permalink
Add base URL as env variable (Fix #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioVdlC committed Feb 13, 2022
1 parent b2c7ffd commit 4ce8fa9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DATABASE_URL=
SESSION_SECRET=
BASE_URL=

ADMIN_EMAIL=

Expand Down
2 changes: 1 addition & 1 deletion app/routes/admin/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const action: ActionFunction = async ({ request }) => {
subject: "Welcome to Fantomely",
text: `Welcome to Fantomely!
You can now finish your registration using the following link: ${
new URL(request.url).origin
process.env.BASE_URL
}/auth/waitlist/callback?email=${encodeURIComponent(
user.email
)}&token=${waitlistToken}`,
Expand Down
2 changes: 1 addition & 1 deletion app/routes/app/websites.details.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const loader: LoaderFunction = async ({ params, request }) => {
const user = await requireCurrentUser(request);
const website = await db.website.findUnique({ where: { id: params.id } });

return { website, user, origin: new URL(request.url).origin };
return { website, user, origin: process.env.BASE_URL };
};

export default function WebsiteDetailsRoute() {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/auth/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const action: ActionFunction = async ({ request }) => {
subject: "Log into fantomely",
text: `Log into fantomely!
Here is your magic link to log into your fantomely account: ${
new URL(request.url).origin
process.env.BASE_URL
}/auth/login/callback?email=${encodeURIComponent(email)}&token=${
magicLink.token
}&redirectTo=${redirectTo}`,
Expand Down
1 change: 1 addition & 0 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ processes = []

[env]
PORT = "8080"
BASE_URL = "https://fantomely.com"

[experimental]
allowed_public_ports = []
Expand Down

0 comments on commit 4ce8fa9

Please sign in to comment.