Skip to content

Commit

Permalink
Made the host overridable as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Gustavsson committed Feb 20, 2018
1 parent 21b5ea1 commit 01236ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ RUN tar -xzf /tmp/v${PHPSAML_VERSION}.tar.gz -C ${WEB_REPO}/functions/php-saml/
# Use system environment variables into config.php
RUN cp ${WEB_REPO}/config.dist.php ${WEB_REPO}/config.php && \
chown www-data /var/www/html/app/admin/import-export/upload && \
sed -i -e "s/\['host'\] = 'localhost'/\['host'\] = 'mysql'/" \
-e "s/\['user'\] = 'phpipam'/\['user'\] = getenv(\"MYSQL_ENV_MYSQL_USER\")/" \
sed -i -e "s/\['host'\] = 'localhost'/\['host'\] = getenv(\"MYSQL_ENV_MYSQL_HOST\") ?: \"mysql\"/" \
-e "s/\['user'\] = 'phpipam'/\['user'\] = getenv(\"MYSQL_ENV_MYSQL_USER\") ?: \"root\"/" \
-e "s/\['pass'\] = 'phpipamadmin'/\['pass'\] = getenv(\"MYSQL_ENV_MYSQL_PASSWORD\")/" \
-e "s/\['port'\] = 3306;/\['port'\] = 3306;\n\n\$password_file = getenv(\"MYSQL_ENV_MYSQL_PASSWORD_FILE\");\nif(file_exists(\$password_file))\n\$db\['pass'\] = preg_replace(\"\/\\\\s+\/\", \"\", file_get_contents(\$password_file));/" \
${WEB_REPO}/config.php
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Here, we store data on the host system under `/my_dir/phpipam` and use a specifi
### Phpipam

```bash
$ docker run -ti -d -p 80:80 -e MYSQL_ENV_MYSQL_USER=root -e MYSQL_ENV_MYSQL_PASSWORD=my-secret-pw--name ipam --link phpipam-mysql:mysql pierrecdn/phpipam
$ docker run -ti -d -p 80:80 -e MYSQL_ENV_MYSQL_PASSWORD=my-secret-pw--name ipam --link phpipam-mysql:mysql pierrecdn/phpipam
```

We are linking the two containers and expose the HTTP port.
Expand Down Expand Up @@ -78,6 +78,7 @@ services:
environment:
- MYSQL_ENV_MYSQL_USER=root
- MYSQL_ENV_MYSQL_PASSWORD=my-secret-pw
- MYSQL_ENV_MYSQL_HOST=mysql
ports:
- "80:80"
volumes:
Expand All @@ -100,7 +101,6 @@ version: '3'
services:
ipam:
environment:
- MYSQL_ENV_MYSQL_USER=root
- MYSQL_ENV_MYSQL_PASSWORD_FILE=/run/secrets/phpipam_mysql_root_password
secrets:
- phpipam_mysql_root_password
Expand Down

0 comments on commit 01236ce

Please sign in to comment.