summaryrefslogtreecommitdiff
path: root/examples/env-vars/src/pages/index.astro
blob: db0369979072f984bc5ccc8a331ba9231ee9db52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
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" />
		<meta name="generator" content={Astro.generator} />
		<title>Astro</title>
	</head>
	<body>
		<h1>Hello, Environment Variables!</h1>
		<script src="/src/scripts/client.ts">

		</script>
	</body>
</html>