Add NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME to mandatory env vars

This commit is contained in:
Aaron William Po
2023-12-01 14:55:56 -05:00
parent 49d5b782a9
commit f5941a9ae5
3 changed files with 12 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ npm install
```bash ```bash
echo "BASE_URL= echo "BASE_URL=
CLOUDINARY_CLOUD_NAME= NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=
CLOUDINARY_KEY= CLOUDINARY_KEY=
CLOUDINARY_SECRET= CLOUDINARY_SECRET=
CONFIRMATION_TOKEN_SECRET= CONFIRMATION_TOKEN_SECRET=
@@ -149,8 +149,8 @@ SPARKPOST_SENDER_ADDRESS=" > .env
- `BASE_URL` is the base URL of the application. - `BASE_URL` is the base URL of the application.
- For example, if you are running the application locally, you can set this to - For example, if you are running the application locally, you can set this to
`http://localhost:3000`. `http://localhost:3000`.
- `CLOUDINARY_CLOUD_NAME`, `CLOUDINARY_KEY`, and `CLOUDINARY_SECRET` are the credentials - `NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME`, `CLOUDINARY_KEY`, and `CLOUDINARY_SECRET` are the
for your Cloudinary account. credentials for your Cloudinary account.
- You can create a free account [here](https://cloudinary.com/users/register/free). - You can create a free account [here](https://cloudinary.com/users/register/free).
- `CONFIRMATION_TOKEN_SECRET` is the secret used to sign the confirmation token used for - `CONFIRMATION_TOKEN_SECRET` is the secret used to sign the confirmation token used for
email confirmation. email confirmation.

View File

@@ -1,10 +1,14 @@
import { v2 as cloudinary } from 'cloudinary'; import { v2 as cloudinary } from 'cloudinary';
import { CLOUDINARY_CLOUD_NAME, CLOUDINARY_KEY, CLOUDINARY_SECRET } from '../env'; import {
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,
CLOUDINARY_KEY,
CLOUDINARY_SECRET,
} from '../env';
import CloudinaryStorage from './CloudinaryStorage'; import CloudinaryStorage from './CloudinaryStorage';
cloudinary.config({ cloudinary.config({
cloud_name: CLOUDINARY_CLOUD_NAME, cloud_name: NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,
api_key: CLOUDINARY_KEY, api_key: CLOUDINARY_KEY,
api_secret: CLOUDINARY_SECRET, api_secret: CLOUDINARY_SECRET,
}); });

View File

@@ -11,7 +11,7 @@ import 'dotenv/config';
*/ */
const envSchema = z.object({ const envSchema = z.object({
BASE_URL: z.string().url(), BASE_URL: z.string().url(),
CLOUDINARY_CLOUD_NAME: z.string(), NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME: z.string(),
CLOUDINARY_KEY: z.string(), CLOUDINARY_KEY: z.string(),
CLOUDINARY_SECRET: z.string(), CLOUDINARY_SECRET: z.string(),
RESET_PASSWORD_TOKEN_SECRET: z.string(), RESET_PASSWORD_TOKEN_SECRET: z.string(),
@@ -56,7 +56,8 @@ export const BASE_URL = parsed.data.BASE_URL;
* @see https://cloudinary.com/console * @see https://cloudinary.com/console
*/ */
export const CLOUDINARY_CLOUD_NAME = parsed.data.CLOUDINARY_CLOUD_NAME; export const NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME =
parsed.data.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME;
/** /**
* Cloudinary API key. * Cloudinary API key.