34 lines
877 B
JavaScript
34 lines
877 B
JavaScript
"use strict"
|
|
|
|
require("dotenv").config();
|
|
|
|
const { envStr } = require("@atproto/common");
|
|
const { PDS, envToCfg, envToSecrets, readEnv } = require("@atproto/pds");
|
|
const pkg = require("@atproto/pds/package.json");
|
|
|
|
const slurs = require("@atproto/pds/dist/handle/explicit-slurs.js")
|
|
slurs.hasExplicitSlur = () => false;
|
|
|
|
const process = require("node:process")
|
|
|
|
const main = async () => {
|
|
const env = readEnv();
|
|
env.version ||= pkg.version;
|
|
const cfg = envToCfg(env);
|
|
const secrets = envToSecrets(env);
|
|
const pds = await PDS.create(cfg, secrets);
|
|
|
|
// allow listening on non-0.0.0.0 addresses
|
|
const host = envStr("BIND_HOST") ?? "127.0.0.1";
|
|
const oListen = pds.app.listen;
|
|
pds.app.listen = (port, ...args) => {
|
|
return oListen(port, host, ...args);
|
|
}
|
|
|
|
await pds.start();
|
|
process.on("SIGTERM", async () => {
|
|
await pds.destroy();
|
|
});
|
|
};
|
|
|
|
main();
|