Skip to content

Instantly share code, notes, and snippets.

View KATT's full-sized avatar
🐱

Alex / KATT KATT

🐱
View GitHub Profile
@KATT
KATT / env.ts
Last active July 1, 2019 22:45 — forked from sibelius/config.ts
Keep all your process.env in a config file, so it is easy to check env vars available
import { cleanEnv, str, num, url } from 'envalid'
const env = cleanEnv(process.env, {
GRAPHQL_URL: url({
devDefault: 'http://localhost:4000/graphql',
}),
PORT: num({
devDefault: 3000,
}),
A: str(),
function getFrontMatter(file) {
return new Promise((resolve, reject) => {
readFile(join(__dirname, '../pages', file), (error, content) => {
if (error) return reject(error);
let doc = fm(content.toString())
resolve(doc);
});
})
}