From 23ebc030fcc8f01396ee44dd3b333eeff251e0b5 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 9 Sep 2025 17:44:44 +0800 Subject: [PATCH] Test add JSON schema for env vars Not really sure if this'll be useful --- env.schema.json | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 env.schema.json diff --git a/env.schema.json b/env.schema.json new file mode 100644 index 00000000..47fb829a --- /dev/null +++ b/env.schema.json @@ -0,0 +1,84 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": ["PHANPY_WEBSITE", "PHANPY_CLIENT_NAME"], + "properties": { + "PHANPY_CLIENT_NAME": { + "type": "string", + "default": "Phanpy", + "minLength": 1, + "maxLength": 100, + "description": "Client name that affects web page title, app title, OpenGraph card title, and client name for authentication" + }, + "PHANPY_WEBSITE": { + "type": "string", + "default": "https://phanpy.social", + "format": "uri", + "description": "Canonical URL of the website, affects OpenGraph card URL and client URL for authentication" + }, + "PHANPY_DEFAULT_INSTANCE": { + "type": "string", + "pattern": "^(?!https?://).*$", + "format": "hostname", + "description": "Default instance for log-in (e.g. 'mastodon.social', without https://)" + }, + "PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL": { + "type": "string", + "format": "uri", + "description": "URL of the instance registration page (e.g. https://mastodon.social/auth/sign_up)" + }, + "PHANPY_PRIVACY_POLICY_URL": { + "type": "string", + "format": "uri", + "description": "URL of the privacy policy page" + }, + "PHANPY_DEFAULT_LANG": { + "type": "string", + "minLength": 2, + "maxLength": 10, + "description": "Default language fallback after multiple detection methods" + }, + "PHANPY_REFERRER_POLICY": { + "type": "string", + "default": "origin", + "enum": [ + "no-referrer", + "no-referrer-when-downgrade", + "origin", + "origin-when-cross-origin", + "same-origin", + "strict-origin", + "strict-origin-when-cross-origin", + "unsafe-url" + ], + "description": "Referrer policy for the site, applied with meta tag on client-side" + }, + "PHANPY_LINGVA_INSTANCES": { + "type": "string", + "separator": " ", + "deprecated": true, + "description": "DEPRECATED: Space-separated list of Lingva instances for translation" + }, + "PHANPY_TRANSLANG_INSTANCES": { + "type": "string", + "separator": " ", + "default": "translang.phanpy.social", + "description": "Space-separated list of Translang instances for translation" + }, + "PHANPY_IMG_ALT_API_URL": { + "type": "string", + "format": "uri", + "description": "API endpoint for self-hosted img-alt-api instance" + }, + "PHANPY_GIPHY_API_KEY": { + "type": "string", + "minLength": 1, + "description": "API key for GIPHY integration" + }, + "PHANPY_DISALLOW_ROBOTS": { + "type": ["string", "boolean"], + "description": "Set to any value to disallow all web crawlers from indexing the site" + } + }, + "additionalProperties": false +} \ No newline at end of file