Kevin Sylvestre
Kevin Sylvestre

Reputation: 38012

Identify User for Heroku One-Off Dynos

Is it possible to identify a user (maybe by Heroku email) that is running a one off dyno (i.e. heroku run rails console)? The use case is attributing changes automatically to that user.

Upvotes: 3

Views: 314

Answers (1)

Dario
Dario

Reputation: 4035

I think is not possible, since a Heroku Dyno is

(...) a lightweight Linux container that runs a single user-specified command.

If you try to check the current logged user with $ id -u -n you will have a different result on every execution, and you don't have any specific id or user ref in the enviroment variables (i.e. $ env) to permit you to infer it.

You can try to pass the user name/id to the app as command argument or enviroment variable.

Upvotes: 1

Related Questions