Settings from the environment

Your task In the code box, write loadConfig(env), which gives back { port, apiUrl, logLevel }: port from PORT or 3000 (a number), apiUrl from API_URL, and logLevel from LOG_LEVEL or info. Throw new Error("Missing API_URL") when API_URL is missing, and new Error("LOG_LEVEL must be one of debug, info, warn, error") for any other level. Call it with process.env and print Config ok: port 3000, log level info, API https://api.copperleaf.test; on an error, print its message with console.error and end with exit code 1. Then press Run my code.

Getting the editor ready