Vault with SvelteKit
Run your SvelteKit application through the GitOps CLI to load Vault secrets as environment variables before the server starts.
Run your application with Vault
Use gops vault run -- followed by your usual SvelteKit start command:
gops vault run \
--api-url https://cloud.getgitops.com/api \
--api-key "$GOPS_API_KEY" \
--project-id 00000000-0000-0000-0000-000000000000 \
--path / \
--env production \
-- npm run start For local development, select the appropriate Vault environment and use your framework's development command after --.
See the official SvelteKit documentation for framework-specific environment and deployment guidance.
Use your environment variables
Secrets are available as environment variables only to the process launched by gops vault run. Read them through your framework's server-side environment API and keep private values out of browser bundles.
import { env } from '$env/dynamic/private';
const databaseUrl = env.DATABASE_URL; Only values intentionally prefixed with PUBLIC_ should be imported from SvelteKit's public environment modules.