From bf37d766bc3f6b05462599d73abc8956938cf86c Mon Sep 17 00:00:00 2001 From: Tianzhou Chen Date: Mon, 1 May 2023 14:35:25 +0800 Subject: [PATCH] chore: add env var to ProcessEnv --- .env.example | 6 +----- process.d.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 process.d.ts diff --git a/.env.example b/.env.example index fa1a469..ca9ba6e 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,2 @@ -# Do not share your OpenAI API key with anyone! It should remain a secret. +# see process.d.ts OPENAI_API_KEY=YOUR_OPENAI_API_KEY -# Optional. -# OPENAI_API_ENDPOINT=YOUR_OPENAI_API_ENDPOINT -# USAGE_DATABASE_URL=postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=sqlchat_usage -# NEXT_PUBLIC_API_KEY=YOUR_API_KEY diff --git a/process.d.ts b/process.d.ts new file mode 100644 index 0000000..dfc23c4 --- /dev/null +++ b/process.d.ts @@ -0,0 +1,13 @@ +declare namespace NodeJS { + export interface ProcessEnv { + // Required. Do not share your OpenAI API key with anyone! It should remain a secret. + OPENAI_API_KEY: string; + // Optional. OpenAI API endpoint. Defaults to https://api.openai.com. + OPENAI_API_ENDPOINT: string; + // Optional. Database connection string to store the usage data. + USAGE_DATABASE_URL: string; + // Optional. API key to protect the backend API endpoint. + // This needs to be exposed to the frontend and must be prefixed with NEXT_PUBLIC_. + NEXT_PUBLIC_API_KEY: string; + } +}