googlearchive / cloud-functions-go

Unofficial Native Go Runtime for Google Cloud Functions
Apache License 2.0
423 stars 44 forks source link

Allow setting environment variables while launching runtime #4

Open salrashid123 opened 7 years ago

salrashid123 commented 7 years ago

Suggest using

use execve instead of execv so that users can set and launch a runtime which may require specific .so files or other env variables

For example:

    char *envp[] =
    {
            "LD_LIBRARY_PATH=/user_code/lib:$LD_LIBRARY_PATH",
            NULL
    };

    execve(bin, const_cast<char* const*>(&args[0]), envp);  
iangudger commented 7 years ago

Do you need to completely override the environment, or would being able to append lines be sufficient? I would like to continue to pass through the environment if possible.

salrashid123 commented 7 years ago

I'd prefer to pass through the env variables (I'd seek to minimize the impact to the runtime and only alter the few bits absolutely necessary and needed). In the example above, it'd be extending the LD_LIBRARY_PATH so the .so files a user would upload would be found.