Skip to content

Commit

Permalink
fix(budget-app): export env var on next.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed May 1, 2024
1 parent 3f4c6c6 commit 1c5f38f
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
3 changes: 1 addition & 2 deletions background-job/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ app.addFunctions(
handleLongQueue,
cacheFunction,
resetCache,
negotiateSignalr,
func.httpGet('test').handler(c => c.text('Hello World' + ' '))
negotiateSignalr
);

const dev = process.env.NODE_ENV === 'development';
Expand Down
23 changes: 23 additions & 0 deletions budget-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions budget-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"google-auth-library": "^9.4.1",
"google-spreadsheet": "^4.1.1",
"next": "14.1.4",
"next-runtime-env": "^3.2.1",
"numbro": "^2.5.0",
"react": "^18",
"react-dom": "^18",
Expand Down
16 changes: 10 additions & 6 deletions budget-app/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,20 @@ import CssBaseline from "@mui/material/CssBaseline";
import theme from "@/theme";
import "./globals.css";
import { ReactQueryClientProvider } from "./components/ReactQueryClientProvider";
import { PublicEnvScript } from "next-runtime-env";

export default function RootLayout(props: { children: React.ReactNode }) {
return (
<html lang="en">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link rel="manifest" href="/manifest.json" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<head>
<PublicEnvScript />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link rel="manifest" href="/manifest.json" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>

<body vaul-drawer-wrapper="">
<AppRouterCacheProvider options={{ enableCssLayer: true }}>
Expand Down
5 changes: 3 additions & 2 deletions budget-app/src/bootstrap-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { env } from "./env";
// import { env } from "./env";
import { env } from "next-runtime-env";
import { initSignalRClient } from "./libs/signalr-client";

/**
Expand All @@ -8,5 +9,5 @@ import { initSignalRClient } from "./libs/signalr-client";
*/

export const signalRConnection = initSignalRClient(
env.NEXT_PUBLIC_AZURE_FUNCTION_URL
env("NEXT_PUBLIC_AZURE_FUNCTION_URL") ?? ""
);
1 change: 0 additions & 1 deletion budget-app/src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
MonthlyBudgetCacheEntity,
MonthlyBudgetSummaryCacheEntity,
} from "./entites/monthly-budget.entity";
import { initSignalRClient } from "./libs/signalr-client";

/**
* Azure Storage Queue Client
Expand Down
2 changes: 1 addition & 1 deletion budget-app/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const envSchema = z.object({
/**
* Azure Function URL
*/
NEXT_PUBLIC_AZURE_FUNCTION_URL: z.string().default("http://localhost:7072"),
NEXT_PUBLIC_AZURE_FUNCTION_URL: z.string().default("http://localhost:7071"),
});

function printSecretFields(
Expand Down

0 comments on commit 1c5f38f

Please sign in to comment.