Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init.sh invalid sed commands #2

Open
mrft opened this issue Jul 10, 2018 · 1 comment
Open

init.sh invalid sed commands #2

mrft opened this issue Jul 10, 2018 · 1 comment

Comments

@mrft
Copy link

mrft commented Jul 10, 2018

sed -i "s|PROJECT_ROOT_VALUE|$PWD|g" nginx-proxy.conf
fails on OSX because -i (edit in-place) expects an extension to backup the original file, so

sed -i .orig "s|PROJECT_ROOT_VALUE|$PWD|g" nginx-proxy.conf

will work, but man sed actually tells you to put -i right before the filename

sed "s|PROJECT_ROOT_VALUE|$PWD|g" -i nginx-proxy.conf
or better
sed "s|PROJECT_ROOT_VALUE|$PWD|g" -i .orig nginx-proxy.conf

Wouldn't it be even better to have nginx-proxy.conf.template files and only create nginx-proxy.conf after replacing the variables? That way you can always run make init again if something changed.

Like so:
sed "s|PROJECT_ROOT_VALUE|$PWD|g" nginx-proxy.conf.template > nginx-proxy.conf

@mrft
Copy link
Author

mrft commented Jul 10, 2018

My version looks like this:

# Using | instead of / because $PWD contains /'s
sed "s|PROJECT_ROOT_VALUE|$PWD|g 
     s|PROJECT_NAME_VALUE|$PROJECT_NAME|g" nginx-proxy.conf.template > nginx-proxy.conf
sed "s|PROJECT_NAME_VALUE|$PROJECT_NAME|g" nginx.conf.template > nginx.conf
sed "s|NGINX_PORT=80|NGINX_PORT=$NGINX_PORT|g
     s|PROJECT_NAME_VALUE|$PROJECT_NAME|g" .env.template > .env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant