Skip to content

Commit c618d37

Browse files
committed
use constants for cloudinary config
1 parent 2bfc2b5 commit c618d37

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/cms/cloudinaryConfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Cloudinary Upload Widget configuration
2+
// These are public, client-side values (not secrets).
3+
// The upload preset restricts what operations are allowed.
4+
export const CLOUDINARY_CLOUD_NAME = "dkg6lnogl";
5+
export const CLOUDINARY_UPLOAD_PRESET = "allen-cell";
6+
export const CLOUDINARY_API_KEY = "989839737788897";

src/cms/widgets/CloudinaryImageWidget.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { useCallback, useEffect, useRef } from "react";
22

3-
// Cloudinary configuration(temp)
4-
const CLOUD_NAME = "dkg6lnogl";
5-
const UPLOAD_PRESET = "allen-cell";
6-
const API_KEY = "989839737788897";
3+
import {
4+
CLOUDINARY_API_KEY,
5+
CLOUDINARY_CLOUD_NAME,
6+
CLOUDINARY_UPLOAD_PRESET,
7+
} from "../cloudinaryConfig";
78

89
// Decap CMS passes Immutable.js Maps — type the minimal surface we use
910
interface ImmutableMap {
@@ -120,9 +121,9 @@ const CloudinaryImageWidget: React.FC<CloudinaryWidgetProps> = ({
120121

121122
widgetRef.current = cloudinary.createUploadWidget(
122123
{
123-
cloudName: CLOUD_NAME,
124-
uploadPreset: UPLOAD_PRESET,
125-
apiKey: API_KEY,
124+
cloudName: CLOUDINARY_CLOUD_NAME,
125+
uploadPreset: CLOUDINARY_UPLOAD_PRESET,
126+
apiKey: CLOUDINARY_API_KEY,
126127
folder: folder,
127128
sources: ["local", "url", "camera"],
128129
multiple: false,

0 commit comments

Comments
 (0)