Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

A common problem we have been running into with importing customer channels is they often use environmental variables which off the bat we do not have in our environments.

To deal with this one little workaround we have in the importer in the shim library is to override os.getenv with a little wrapper which give default values for undefined environmental variables and it stored them all in a global table which you view.

The shim populates an environmental variable _EnvVarList so that you can see all the env variables:

This is the source code:

_EnvVarList = {}
-- WHY DO WE DO THIS?
-- In working with customers we frequently ran into problems running scripts without environmental variables defined
-- So this shim sets them to something obviously wrong and builds up a catalogue of variables in _EnvVarList
_GetEnv = os.getenv
os.getenv = function(K)
   local X = _GetEnv(K)

   if (X == nil) then 
      X = "ENVIRONMENTAL VARIABLE "..K.." is not defined - this is in iguana_shim.lua!"
    end
    _EnvVarList[K] = X
    return X
end

  • No labels