How push config-passwords.txt file to phpfog server from local production with git?

StackOverflow https://stackoverflow.com/questions/11887484

  •  25-06-2021
  •  | 
  •  

Question

I am working with phpfog. I use git to push my code to phpfog. My problem: I have config-passwords.txt with my local passwords and user names, i have other passwords and user names in production. Usually i upload manually to server the configs files and then change them, but i dont see that phpfog gives such option.What should I do?

Thanks

Was it helpful?

Solution

One way to allow for different settings or passwords between your development and production environments is to use environment variables. PHP Fog allows you to configure custom environment variables in the app console. You would then set the same envars on your dev system.

Example:

Local Machine: Edit your .bash_profile or export the following line.

CONFIG_PASSWORD=devpassword1

In the PHP Fog App Console set the following environment var:

CONFIG_PASSWORD=prodpassword1

Then access them from your php app:

$config_password = getenv("CONFIG_PASSWORD");

Add as many different env vars as you need. This way of accessing the password will work the same in both dev and production environments so your code does not need to change.

See my answer to a similar question: https://stackoverflow.com/a/8786086/78685

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top