I’m using node.js on macos but although I reference process.env.MORPH_API_KEY it is only populated on morph.io and is ‘undefined’ on local.
I’m guessing that this is the same issue as reported on Github https://github.com/openaustralia/morph/issues/1187.
Code that you run via morph-cli is completely independent of the scrapers that exist on morph.io. They’re not attached to a particular scraper and so don’t have access to the environment variables that are set.
Also, code that is run via morph-cli is not visible anywhere so there is no harm in embedding secret values in the code. This is perfectly fine for prototyping things. When you’re close to getting things working refactor your code (to pull out the secret values into environment variables) and check it into git.
Hope that helps.