add pds service source code
This commit is contained in:
parent
3e4a52e6dd
commit
f715b42a47
6 changed files with 5961 additions and 0 deletions
2
pds/.gitignore
vendored
2
pds/.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/data
|
||||
/node_modules
|
||||
/.env
|
||||
|
|
23
pds/flake.lock
Normal file
23
pds/flake.lock
Normal file
|
@ -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
|
||||
}
|
13
pds/flake.nix
Normal file
13
pds/flake.nix
Normal file
|
@ -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
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
29
pds/index.mjs
Normal file
29
pds/index.mjs
Normal file
|
@ -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();
|
5878
pds/package-lock.json
generated
Normal file
5878
pds/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
16
pds/package.json
Normal file
16
pds/package.json
Normal file
|
@ -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 a new issue