https://github.com/cba85/dokku-env-converter
A bash script to convert PHP .env file to inlined variables for Dokku.
https://github.com/cba85/dokku-env-converter
dokku environment-variables php
Last synced: about 2 months ago
JSON representation
A bash script to convert PHP .env file to inlined variables for Dokku.
- Host: GitHub
- URL: https://github.com/cba85/dokku-env-converter
- Owner: cba85
- License: mit
- Created: 2018-08-03T18:20:58.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-10T12:41:43.000Z (almost 8 years ago)
- Last Synced: 2025-03-11T21:44:58.933Z (over 1 year ago)
- Topics: dokku, environment-variables, php
- Language: Shell
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dokku Env Converter
A simple bash script to convert PHP `.env` file from package [vlucas/phpdotenv](https://github.com/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:
```bash
$ chmod +x dokku-env-converter.sh
```
2. Create an alias in your `.bash_profile` or in your `.zshrc` file:
```bash
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:
```bash
$ dokku-env-converter app_name
```
### Results:
```bash
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.