Clean up config

This commit is contained in:
Alex Gleason 2024-09-11 18:30:23 -05:00
parent 20d1f885ac
commit f7ee59146e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 2 additions and 21 deletions

View file

@ -35,21 +35,11 @@ class Conf {
}
return this._pubkey;
}
/** Ditto admin secret key as a Web Crypto key. */
static get cryptoKey(): Promise<CryptoKey> {
return crypto.subtle.importKey(
'raw',
Conf.seckey,
{ name: 'HMAC', hash: 'SHA-256' },
false,
['sign', 'verify'],
);
}
/** Port to use when serving the HTTP server. */
static get port(): number {
return parseInt(Deno.env.get('PORT') || '4036');
}
/** Relay URL to the Ditto server's relay. */
static get relay(): `wss://${string}` | `ws://${string}` {
const { protocol, host } = Conf.url;
return `${protocol === 'https:' ? 'wss:' : 'ws:'}//${host}/relay`;
@ -188,12 +178,6 @@ class Conf {
'system',
];
}
/** Proof-of-work configuration. */
static pow = {
get registrations(): number {
return Number(Deno.env.get('DITTO_POW_REGISTRATIONS') ?? 20);
},
};
/** Domain of the Ditto server as a `URL` object, for easily grabbing the `hostname`, etc. */
static get url(): URL {
return new URL(Conf.localDomain);

View file

@ -63,9 +63,6 @@ const instanceV1Controller: AppController = async (c) => {
nostr: {
pubkey: Conf.pubkey,
relay: `${wsProtocol}//${host}/relay`,
pow: {
registrations: Conf.pow.registrations,
},
},
rules: [],
});