Get install path in template


#1

Is there a way to get the path where the package has been installed on the file system from within the template?

like /hab/pkgs/org/package/0.1.0/20180716211822/

I tried to reference the variables like {{ pkg_svc_path }} or tried to make it configurable and set is using set_runtime_env from the plan, but neither worked.


#2

Give {{pkg.path}} a shot.

I use it in a template for an nginx config like so:

server {
  listen 80;
  root {{pkg.path}}/data;
  index index.html;
}

#3

awesome. thank you very much. Just where do you need to look to find that stuff?


#4

https://www.habitat.sh/docs/reference/#template-data


#5

thanks so much. I have been looking in the wrong places all the time :man_facepalming: