mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-06 01:16:58 -06:00
setup CRON_SECRET, DIRECTUS_API_TOKEN, GITHUB_API_TOKEN, static directus token authentication
This commit is contained in:
3
src/env/schema.mjs
vendored
3
src/env/schema.mjs
vendored
@@ -6,6 +6,9 @@ import { z } from "zod";
|
|||||||
* This way you can ensure the app isn't built with invalid env vars.
|
* This way you can ensure the app isn't built with invalid env vars.
|
||||||
*/
|
*/
|
||||||
export const serverSchema = z.object({
|
export const serverSchema = z.object({
|
||||||
|
CRON_SECRET: z.string(),
|
||||||
|
GITHUB_API_TOKEN: z.string(),
|
||||||
|
DIRECTUS_API_TOKEN: z.string(),
|
||||||
DIRECTUS_REVALIDATE_KEY: z.string(),
|
DIRECTUS_REVALIDATE_KEY: z.string(),
|
||||||
NODE_ENV: z.enum(["development", "test", "production"]),
|
NODE_ENV: z.enum(["development", "test", "production"]),
|
||||||
TITLE: z.preprocess((value) => {
|
TITLE: z.preprocess((value) => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { createDirectus, rest } from "@directus/sdk";
|
import { env } from "@/env/server.mjs";
|
||||||
|
import { createDirectus, rest, staticToken } from "@directus/sdk";
|
||||||
|
|
||||||
export interface Schema {
|
export interface Schema {
|
||||||
metadata: Metadata;
|
metadata: Metadata;
|
||||||
@@ -23,20 +24,28 @@ export interface ProjectTechnology {
|
|||||||
|
|
||||||
export interface Project {
|
export interface Project {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
// One2Many
|
|
||||||
links: number[] | ProjectLink[];
|
|
||||||
// Many2Many
|
|
||||||
technologies: number[] | ProjectTechnology[];
|
|
||||||
|
|
||||||
|
// core fields
|
||||||
|
date_created: string;
|
||||||
|
date_updated: string;
|
||||||
|
sort: number; // used for ordering
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
// relationships
|
||||||
|
links: number[] | ProjectLink[]; // One2Many
|
||||||
|
technologies: number[] | ProjectTechnology[]; // Many2Many
|
||||||
|
|
||||||
|
// relevant fields
|
||||||
icon: string | null;
|
icon: string | null;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
shortDescription: string;
|
shortDescription: string;
|
||||||
|
|
||||||
featured: boolean;
|
// misc fields
|
||||||
wakatimeOffset: number | null;
|
featured: boolean; // places the project in the 'featured' section
|
||||||
bannerImage: string;
|
autocheckUpdated: boolean; // triggers a cron job to check for updates
|
||||||
|
wakatimeOffset: number | null; // offsets the WakaTime fetched data
|
||||||
|
bannerImage: string; // file identifier
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Link {
|
export interface Link {
|
||||||
@@ -62,6 +71,8 @@ export interface Metadata {
|
|||||||
resumeFilename: string;
|
resumeFilename: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const directus = createDirectus<Schema>("https://api.xevion.dev").with(rest());
|
const directus = createDirectus<Schema>("https://api.xevion.dev")
|
||||||
|
.with(staticToken(env.DIRECTUS_API_TOKEN))
|
||||||
|
.with(rest());
|
||||||
|
|
||||||
export default directus;
|
export default directus;
|
||||||
|
|||||||
Reference in New Issue
Block a user