summaryrefslogtreecommitdiff
path: root/examples/env-vars/src/pages/index.astro
blob: 0d19b9a46d44bef2e5fe31b465d196bee9a1ba25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
const { SSR, DB_PASSWORD, PUBLIC_SOME_KEY } = import.meta.env;

// DB_PASSWORD is available because we're running on the server
console.log({ SSR, DB_PASSWORD });

// PUBLIC_SOME_KEY is available everywhere
console.log({ SSR, PUBLIC_SOME_KEY });
---

<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width" />
		<title>Astro</title>
	</head>
	<body>
		<h1>Hello, Environment Variables!</h1>
		<script type="module" src="/src/scripts/client.ts"></script>
	</body>
</html>