galnir / Master-Bot

A Discord music bot and dashboard with slash commands, playlist support, Spotify, music quiz, saved playlists, lyrics, gifs and more
MIT License
464 stars 373 forks source link

Add NEXTAUTH_URL_INTERNAL option #757

Closed ghost closed 1 year ago

ghost commented 1 year ago

Fix for the private ip vs public ip problem in the dashboard. All I had to do to fix this was change the following section in packages\dashboard\src\env\schema.mjs.

export const serverSchema = z.object({
  NEXTAUTH_SECRET: z.string(),
  NEXTAUTH_URL: z.string().url(),
  NEXTAUTH_URL_INTERNAL: z.string().url(),
  DISCORD_CLIENT_ID: z.string(),
  DISCORD_CLIENT_SECRET: z.string(),
});

With this we can now set the following environment variables in the .env file:

With the Public Domain or IP

NEXTAUTH_URL=http://domain:3000
NEXTAUTH_URL_INTERNAL=http://localhost:3000

Without the Public Domain or IP

NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_URL_INTERNAL=http://localhost:3000

A working example of this would be as follows:

NEXTAUTH_URL=http://72.222.170.15:3000
NEXTAUTH_URL_INTERNAL=http://localhost:3000

Here is the page where I found this fix at if it helps.

galnir commented 1 year ago

🚀