diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..ceaa7546 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +# Default article to display on app load +# This should be a valid naddr1... string (NIP-19 encoded address pointer to a kind:30023 long-form article) +VITE_DEFAULT_ARTICLE_NADDR=naddr1qvzqqqr4gupzqmjxss3dld622uu8q25gywum9qtg4w4cv4064jmg20xsac2aam5nqqxnzd3cxqmrzv3exgmr2wfesgsmew diff --git a/src/App.tsx b/src/App.tsx index 552c8c89..a584f12c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,9 @@ import { createAddressLoader } from 'applesauce-loaders/loaders' import Login from './components/Login' import Bookmarks from './components/Bookmarks' -const DEFAULT_ARTICLE = 'naddr1qvzqqqr4gupzqmjxss3dld622uu8q25gywum9qtg4w4cv4064jmg20xsac2aam5nqqxnzd3cxqmrzv3exgmr2wfesgsmew' +// Load default article from environment variable with fallback +const DEFAULT_ARTICLE = import.meta.env.VITE_DEFAULT_ARTICLE_NADDR || + 'naddr1qvzqqqr4gupzqmjxss3dld622uu8q25gywum9qtg4w4cv4064jmg20xsac2aam5nqqxnzd3cxqmrzv3exgmr2wfesgsmew' function App() { const [eventStore, setEventStore] = useState(null) diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 00000000..a05d581c --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,9 @@ +/// + +interface ImportMetaEnv { + readonly VITE_DEFAULT_ARTICLE_NADDR: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +}