2022-05-25 02:57:24 +03:00
|
|
|
import kleur from "kleur";
|
2022-07-27 19:09:58 +03:00
|
|
|
import bcrypt from "bcryptjs";
|
|
|
|
|
2022-05-25 02:57:24 +03:00
|
|
|
kleur.enabled = true;
|
|
|
|
|
|
|
|
export async function environmentVariable(name) {
|
|
|
|
const result = process.env[name];
|
|
|
|
if (result) {
|
|
|
|
return result;
|
|
|
|
} else {
|
|
|
|
throw `No environment variable called ${kleur
|
|
|
|
.yellow()
|
|
|
|
.underline(name)}\n\nAvailable:\n\n${Object.keys(process.env)
|
|
|
|
.slice(0, 5)
|
|
|
|
.join("\n")}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function hello(name) {
|
|
|
|
return `147 ${name}!!`;
|
|
|
|
}
|
2022-07-27 19:09:58 +03:00
|
|
|
export async function hashPassword(password) {
|
|
|
|
return await bcrypt.hash(password, process.env.SMOOTHIES_SALT);
|
|
|
|
}
|
2022-05-25 02:57:24 +03:00
|
|
|
|
|
|
|
function waitFor(ms) {
|
|
|
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
|
}
|