CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/database/pool/password.ts
Views: 687
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