feat: added configs for the auth service

feature/auth
Artem-Darius Weber 2 years ago
parent 3083015598
commit 3d0d30a24f

@ -0,0 +1,10 @@
import { readFileSync } from "fs";
import { join } from "path";
export default () => {
if (process.env.PRIVATE_KEY_PATH === undefined) throw new Error("Incorrect PRIVATE_KEY_PATH format in configurations");
if (process.env.PUBLIC_KEY_PATH === undefined) throw new Error("Incorrect PUBLIC_KEY_PATH format in configurations");
const private_key = readFileSync(join("./", process.env.PRIVATE_KEY_PATH), "utf8");
const public_key = readFileSync(join("./", process.env.PUBLIC_KEY_PATH), "utf8");
return { private_key, public_key };
};

@ -0,0 +1,5 @@
export default () => {
const port = process.env.PORT !== undefined ? parseInt(process.env.PORT, 10) : 80;
if (isNaN(port) || port < 0) throw new Error("Incorrect port format in configurations");
return { port };
};

@ -0,0 +1,2 @@
export const UUIDv4 = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
export const SHA256 = /^[a-f0-9]{64}$/i;
Loading…
Cancel
Save