Skip to content

Commit

Permalink
fix: public env
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbrusegard committed Sep 8, 2024
1 parent cb3c8df commit bfb79ef
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# General
NODE_ENV="development"
SITE_URL="http://localhost:3000"
NEXT_PUBLIC_SITE_URL="http://localhost:3000"

# Database
DATABASE_HOST="localhost"
Expand Down
2 changes: 1 addition & 1 deletion next-sitemap.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { env } from '@/env';

/** @type {import('next-sitemap').IConfig} */
const config = {
siteUrl: env.SITE_URL,
siteUrl: env.NEXT_PUBLIC_SITE_URL,
generateRobotsTxt: true,
generateIndexSitemap: false,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/providers/TRPCProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function TRPCProvider(props: { children: React.ReactNode }) {
}),
unstable_httpBatchStreamLink({
transformer: SuperJSON,
url: `${env.SITE_URL}/api/data`,
url: `${env.NEXT_PUBLIC_SITE_URL}/api/data`,
headers: () => {
const headers = new Headers();
headers.set('x-trpc-source', 'nextjs-react');
Expand Down
5 changes: 2 additions & 3 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const env = createEnv({
*/
server: {
NODE_ENV: z.enum(['development', 'test', 'production']),
SITE_URL: z.string(),
DATABASE_HOST: z.string(),
DATABASE_PORT: z.string(),
DATABASE_USER: z.string(),
Expand All @@ -32,7 +31,7 @@ export const env = createEnv({
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string(),
NEXT_PUBLIC_SITE_URL: z.string(),
},

/**
Expand All @@ -41,7 +40,7 @@ export const env = createEnv({
*/
runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
SITE_URL: process.env.SITE_URL,
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL,
DATABASE_HOST: process.env.DATABASE_HOST,
DATABASE_PORT: process.env.DATABASE_PORT,
DATABASE_USER: process.env.DATABASE_USER,
Expand Down
2 changes: 1 addition & 1 deletion src/server/auth/feide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const feideOAuthClient = new OAuth2Client(
env.FEIDE_AUTHORIZATION_ENDPOINT,
env.FEIDE_TOKEN_ENDPOINT,
{
redirectURI: `${env.SITE_URL}/api/auth/feide`,
redirectURI: `${env.NEXT_PUBLIC_SITE_URL}/api/auth/feide`,
},
);

Expand Down

0 comments on commit bfb79ef

Please sign in to comment.