Get install path in template

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.

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;
}
2 Likes

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

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

1 Like

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