Open emil-nasso opened 7 years ago
I'm thinking of $SUP_PWD
or $SUP_WORKDIR
env var. But what would we do if the directory didn't exist?
Do you mean that the user sets the $SUP_PWD
and $SUP_WORKDIR
with the -e
flag when executing the sup binary and sup uses that to change directory?
I'm not sure what to do when the directory doesn't exist. We could just mkdir -p
it but it feels safer to just print out an error message.
Yea, user could either pass the env var via -e
flag or define the vars globally / per network in the Supfile.
Hello, Is this feature still pending or is there another way to set the working directory? Thanks
I think it would be very nice to be able to change the default working directory for a network.
Most of my experiments/mini-projects run on one server (that is running docker containers). I have one user that i SSH with to manage all these projects. Each project is in a directory in that users home directory.
Take a look at this example:
Imagine I had some real commands there instead. Every time a command is run, it is done in a new session. Me changing the directory in the
chdir
command doesn't affect the other commands. It makes sense and I think it would be a bit chaotic if it wasn't like that. I'm not proposing to change that.The fact is that the Sup files become messy though. I have to prefix every single command with
cd /my/directory; ...
. And even worse, it breaks my local environment. I don't use the same directory structure there...What I propose it this:
You specify working directory for each network. It is optional. If it is not specified, the behavior would continue to be exactly what it is today. Before sup runs each command it would change the directory to what is specified in
workdir
, if it exists.It would help clean up my Supfile and it would make me possible to deploy to both localhost and production with the same file.
I would like to make this change. I'm willing to write the code, tests, documentation etc.
I just wanted to vent it here first, just to make sure I was proposing something that was already being worked on, was not wanted or if there are better solutions.
Let me know what you think!