Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/database/pool/password.ts
1496 views
1
import { join } from "path";
2
import { secrets } from "@cocalc/backend/data";
3
import { readFileSync } from "fs";
4
5
export default function dbPassword(): string | undefined {
6
const filename = join(secrets, "postgres");
7
try {
8
// fine to use sync, since reading db password happens only on startup
9
return readFileSync(filename).toString().trim();
10
} catch {
11
return undefined;
12
}
13
}
14
15