Sensu-go handler not using environment variables

Hello.

I’m running a set of handlers, but having issues with their environments.

my service runs as sensu user, and I added the gem path to .bash_profile
export GEM_HOME=/opt/sensu-plugins-ruby/embedded/

However, the handlers it not taking the variable, I have to add it explicitly

ENV Vars

GEM_HOME=/opt/sensu-plugins-ruby/embedded/

but then I run into other issues with permissions.
What’s the expected way to populate handler’s environment ?
Are they running with a different user than the main service ?

I checked under the handlers documentation, but no references to user or inheriting settings

Thanks a lot for tour help.

Hey,
Are you using the official provided linux packages for sensu-backend? If so the service definitions for both the sysvinit and systemd styled services let you set environment variables in either
/etc/sysconfig/sensu-backend
or
/etc/default/sensu-backend
Reference: https://docs.sensu.io/sensu-go/latest/reference/backend/#configuration-via-environment-variables

Thanks Jeff.
I wanted to use sensu users’ profile, but I can add it to the handler env too.

I ran into some permissions issues, but I see handler runs as sensu, but in a clean env.