Navigation Menu

Skip to content

cba85/dokku-env-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Dokku Env Converter

A simple bash script to convert PHP .env file from package vlucas/phpdotenv to inlined variables for Dokku.

Basically, this script removes the comments (#) of the .env file, inlines it and adds dokku config:set to create the environement variables in Dokku.

Installation

Install globally

  1. Add execution rights to the script:
    $ chmod +x dokku-env-converter.sh
  2. Create an alias in your .bash_profile or in your .zshrc file:
    alias dokku-env-converter='~/path/to/dokku-env-converter/dokku-env-converter.sh'

Example

Go to your PHP repository that contains the .env file:

.env file example:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=root
DB_PASSWORD=root

Launch script:

$ dokku-env-converter app_name

Results:

dokku config:set app_name DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=database_name DB_USERNAME=root DB_PASSWORD=root

Add environment variables in Dokku:

Then, just copy and paste the results in your Dokku server.

About

A bash script to convert PHP .env file to inlined variables for Dokku.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages