decentralised sync engine

feat: constellation url env var

serenity 914a9a81 cba52094

Changed files
+20
src
lib
+4
.example.env
···
# defaults to did:web:localhost
SERVICE_DID="did:web:localhost"
# required.
# owner did
# used to verify ownership of this lattice and its related channels
···
# defaults to did:web:localhost
SERVICE_DID="did:web:localhost"
+
# constellation instance. provide the full url.
+
# defaults to the public microcosm.blue constellation instance.
+
CONSTELLATION_URL="https://constellation.microcosm.blue/"
+
# required.
# owner did
# used to verify ownership of this lattice and its related channels
+16
src/lib/env.ts
···
}
export const SERVICE_DID = serviceDidParsed ?? "did:web:localhost";
const ownerDid = process.env.OWNER_DID;
const {
success: ownerDidParseSuccess,
···
}
export const SERVICE_DID = serviceDidParsed ?? "did:web:localhost";
+
+
const constellationUrl = process.env.CONSTELLATION_URL;
+
let constellationUrlParsed: URL | undefined;
+
try {
+
constellationUrlParsed = new URL(constellationUrl ?? "");
+
} catch (err) {
+
+
+
console.warn(
+
"Invalid CONSTELLATION_URL. Please ensure that the environment variable is a valid URL.",
+
);
+
console.warn("Falling back to default constellation instance.");
+
console.warn(err);
+
}
+
export const CONSTELLATION_URL = constellationUrlParsed ?? new URL("https://constellation.microcosm.blue/");
+
const ownerDid = process.env.OWNER_DID;
const {
success: ownerDidParseSuccess,