mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-05 23:16:57 -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.
|
||||
*/
|
||||
export const serverSchema = z.object({
|
||||
CRON_SECRET: z.string(),
|
||||
GITHUB_API_TOKEN: z.string(),
|
||||
DIRECTUS_API_TOKEN: z.string(),
|
||||
DIRECTUS_REVALIDATE_KEY: z.string(),
|
||||
NODE_ENV: z.enum(["development", "test", "production"]),
|
||||
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 {
|
||||
metadata: Metadata;
|
||||
@@ -23,20 +24,28 @@ export interface ProjectTechnology {
|
||||
|
||||
export interface Project {
|
||||
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;
|
||||
name: string;
|
||||
description: string;
|
||||
shortDescription: string;
|
||||
|
||||
featured: boolean;
|
||||
wakatimeOffset: number | null;
|
||||
bannerImage: string;
|
||||
// misc fields
|
||||
featured: boolean; // places the project in the 'featured' section
|
||||
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 {
|
||||
@@ -62,6 +71,8 @@ export interface Metadata {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user