mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Clean up config
This commit is contained in:
parent
20d1f885ac
commit
f7ee59146e
2 changed files with 2 additions and 21 deletions
|
|
@ -35,21 +35,11 @@ class Conf {
|
||||||
}
|
}
|
||||||
return this._pubkey;
|
return this._pubkey;
|
||||||
}
|
}
|
||||||
/** Ditto admin secret key as a Web Crypto key. */
|
/** Port to use when serving the HTTP server. */
|
||||||
static get cryptoKey(): Promise<CryptoKey> {
|
|
||||||
return crypto.subtle.importKey(
|
|
||||||
'raw',
|
|
||||||
Conf.seckey,
|
|
||||||
{ name: 'HMAC', hash: 'SHA-256' },
|
|
||||||
false,
|
|
||||||
['sign', 'verify'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static get port(): number {
|
static get port(): number {
|
||||||
return parseInt(Deno.env.get('PORT') || '4036');
|
return parseInt(Deno.env.get('PORT') || '4036');
|
||||||
}
|
}
|
||||||
|
/** Relay URL to the Ditto server's relay. */
|
||||||
static get relay(): `wss://${string}` | `ws://${string}` {
|
static get relay(): `wss://${string}` | `ws://${string}` {
|
||||||
const { protocol, host } = Conf.url;
|
const { protocol, host } = Conf.url;
|
||||||
return `${protocol === 'https:' ? 'wss:' : 'ws:'}//${host}/relay`;
|
return `${protocol === 'https:' ? 'wss:' : 'ws:'}//${host}/relay`;
|
||||||
|
|
@ -188,12 +178,6 @@ class Conf {
|
||||||
'system',
|
'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. */
|
/** Domain of the Ditto server as a `URL` object, for easily grabbing the `hostname`, etc. */
|
||||||
static get url(): URL {
|
static get url(): URL {
|
||||||
return new URL(Conf.localDomain);
|
return new URL(Conf.localDomain);
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,6 @@ const instanceV1Controller: AppController = async (c) => {
|
||||||
nostr: {
|
nostr: {
|
||||||
pubkey: Conf.pubkey,
|
pubkey: Conf.pubkey,
|
||||||
relay: `${wsProtocol}//${host}/relay`,
|
relay: `${wsProtocol}//${host}/relay`,
|
||||||
pow: {
|
|
||||||
registrations: Conf.pow.registrations,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
rules: [],
|
rules: [],
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue