decentralised message store

feat: prism url env setup

serenity c64ca5ff d351ba48

Changed files
+21
src
lib
+7
.example.env
···
# to tell if you're in dev or prod. defaults to dev.
# if running in prod, set to 'production'
NODE_ENV="development"
+
+
# required. defaults to gemstone's jetstream.
+
# prism is basically jetstream.
+
# for now, we use our own instance of jetstream, but in future, it will be a re-implementation of jetstream called prism.
+
# https://tangled.org/@gmstn.systems/prism
+
# must be full 'wss://' url, including the path to the subscribe endpoint
+
PRISM_URL="wss://jetstream.gmstn.systems/subscribe"
+14
src/lib/env.ts
···
}
export const OWNER_DID = ownerDidParsed;
+
const prismUrl = process.env.PRISM_URL;
+
let prismUrlParsed: URL | undefined;
+
try {
+
prismUrlParsed = new URL(prismUrl ?? "");
+
} catch (err) {
+
console.warn(
+
"Invalid PRISM_URL. Please ensure that the environment variable is a valid URL.",
+
);
+
console.warn("Falling back to default prism instance.");
+
console.warn(err);
+
}
+
export const PRISM_URL =
+
prismUrlParsed ?? new URL("wss://jetstream.gmstn.systems/subscribe");
+
const nodeEnv = process.env.NODE_ENV;
export const NODE_ENV = nodeEnv ?? "development";