I have created a small Node.js application, which also invokes a python script.
In both the node server and the python script, exist hardcoded paths.
In Python's case:
myStoreDir = '/home/user1/Desktop/app/dataContainer/'
In Node's case:
var pathAndFileName = '/home/user1/Desktop/app/dataContainer/'+fileName;
Of course the small app works flawlessly in my system. But when i gave the code to a colleague to run the app in a docker container, he had problems obvisouly, as these paths did not exist on his system.
Is there a way to declare those paths differently, both in node.js, and in python. So that anyone can run it?
Please have in mind, that the file structure /app/dataContainer
, will exist for sure, because this is the result of a git pull
.
Is there a way to fix this, so the path previous to /app
, is fixed to the location of the git pulled directory?
You can either use relative paths or provide the path as an environment variable or as part of the arguments when you invoke the scripts