Initial scaffold

This commit is contained in:
Storme-bit
2026-04-03 06:03:17 -07:00
commit 0e1d592980
13 changed files with 207 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
{
"name": "@loom/shared",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {}
}

View File

@@ -0,0 +1,17 @@
// A simple utility to load environment variables from a .env file
// Each service calls this at startup to load its configuration
function getEnv(key, defaultValue){
const value = process.env[key];
//check if the desired value exists, if not check if a default value was provided, if not throw an error
if (value === undefined) {
if (defaultValue === undefined) {
throw new Error(`Missing required environment variable: ${key}`);
}
return defaultValue;
}
return value;
}
module.exports = {getEnv};

View File

@@ -0,0 +1,3 @@
const {getEnv} = require('./config/env');
module.exports = {getEnv};