Post A2FSpn4FVCJPgYB5Zg by mike@z.macgirvin.com
 (DIR) More posts by mike@z.macgirvin.com
 (DIR) Post #A2FKyx9wYE3vxQhQrQ by seanking@traboone.com
       2020-12-16T03:42:41.469221Z
       
       0 likes, 0 repeats
       
       Anyone know how to set or unset environment variables based on what directory one is currently in? Asking for a friend. (No, editing profile nor bashrc files works. Those files only run when during log in.)
       
 (DIR) Post #A2FLJjaODCWXwQyjtw by seanking@traboone.com
       2020-12-16T03:46:28.728074Z
       
       0 likes, 0 repeats
       
       What I’m trying to do is be able to have the MIX_ENV environment variable set to prod for me by default automatically (unless I otherwise specify before mix) whenever I turn to run a mix command in the two Elixir apps I have on my server.
       
 (DIR) Post #A2FQ5MbXMLDGNlTxtQ by lnxw37a2@pleroma.soykaf.com
       2020-12-16T04:39:56.084317Z
       
       1 likes, 0 repeats
       
       @seanking I haven’t used it, but there’s something in Debian / Ubuntu repos called direnv that sounds similar to what you’re asking about.
       
 (DIR) Post #A2FQaqzoPkTVcJqujg by seanking@traboone.com
       2020-12-16T04:45:36.201330Z
       
       0 likes, 0 repeats
       
       @lnxw37a2 Yeah, I was looking into that, too. I mean that could work. It’s just that I would likely need the .envrc file gitignored. For Fuck Gab!, that would be easy. But regarding Pleroma per se, that’s a different story you know since I have a from source installation. I guess I could do a .envrc in the /opt folder. IDK. Or maybe it’s just best to have MIX_ENV defined in a file in the /etc/profile.d directory without any conditional around it.
       
 (DIR) Post #A2FSpn4FVCJPgYB5Zg by mike@z.macgirvin.com
       2020-12-16T04:57:41Z
       
       1 likes, 0 repeats
       
       Was going to suggest something with setting the prompt (PS1); which I use to display the current directory and git branch (if applicable) by calling a helper function. The helper function could be anything. But direnv looks like it could be a winner.