PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 19, 2022

[FIXED] How do I provide environmental variable with my custom Cloud Foundry buildpack?

 August 19, 2022     cloud-foundry, environment-variables     No comments   

Issue

I have extra simple custom sidecar buildpack. All it does in /bin/supply is downloading and untarring to $DEPS_DIR/$DEPS_IDX/mylibrary certain dependency library. Since I can have more than one sidecar buildpack I don't know $DEPS_IDX for mylibrary beforehand. I want to set up from within /bin/supply of my custom buildpack environment variable export MYLIBRARY_PATH=$DEPS_DIR/$DEPS_IDX/mylibrary so main application could use it. How do I do that? Where do I put that export?

I know that I can put that variable to manifest.yml or set up it with cf set-env but that's fragile and I want to set up env var close to place where I supply related dependency. I saw that some custom buildpacks write custom scripts to $DEPS_DIR/$DEPS_IDX/profile.d. I tried that but those scripts are never executed. Should I try to reach /etc/profile.d from /bin/supply?


Solution

Put script exporting that value to ${BUILD_DIR}/.profile.d/ directory (it's where app located at build). All scripts from there are moved to /etc/profile.d and sourced at buildpack launch. BUILD_DIR should be visible during /bin/supply



Answered By - ScalewingedAcidicorn
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing