add pds service source code
parent
3e4a52e6dd
commit
f715b42a47
|
@ -1 +1,3 @@
|
|||
/data
|
||||
/node_modules
|
||||
/.env
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 0,
|
||||
"narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=",
|
||||
"path": "/nix/store/ly4s3hw35dd1c2vsd694y2715pc1d2c1-source",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
description = "pds";
|
||||
|
||||
outputs = { self, nixpkgs }: let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
in {
|
||||
devShells."x86_64-linux".default = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pkgs.nodejs_22
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
import "dotenv/config";
|
||||
|
||||
import { envStr } from "@atproto/common";
|
||||
import { PDS, envToCfg, envToSecrets, readEnv } from "@atproto/pds";
|
||||
import pkg from "@atproto/pds/package.json" with { type: "json" };
|
||||
|
||||
import process from "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();
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "pds",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"description": "Service entrypoint for atproto personal data server",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@atproto/pds": "0.4.71",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.21.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue