forked from sanity-io/sanity-template-astro-clean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity.config.js
31 lines (31 loc) · 1.01 KB
/
sanity.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Different environments use different variables
const projectId =
import.meta.env.PUBLIC_SANITY_STUDIO_PROJECT_ID ||
import.meta.env.PUBLIC_SANITY_PROJECT_ID;
const dataset =
import.meta.env.PUBLIC_SANITY_STUDIO_DATASET ||
import.meta.env.PUBLIC_SANITY_DATASET;
// Feel free to remove this check if you don't need it
if (!projectId || !dataset) {
throw new Error(
`Missing environment variable(s). Check if named correctly in .env file.\n\nShould be:\nPUBLIC_SANITY_STUDIO_PROJECT_ID=${projectId}\nPUBLIC_SANITY_STUDIO_DATASET=${dataset}\n\nAvailable environment variables:\n${JSON.stringify(
import.meta.env,
null,
2,
)}`,
);
}
import { defineConfig } from "sanity";
import { structureTool } from "sanity/structure";
import { visionTool } from "@sanity/vision";
import { schemaTypes } from "./schema";
export default defineConfig({
name: "project-name",
title: "Project Name",
projectId,
dataset,
plugins: [structureTool(), visionTool()],
schema: {
types: schemaTypes,
},
});