Open typekpb opened 8 years ago
I like the idea, does anybody feel like filing a PR? :+1: :)
Also, I suppose this is a duplicate of #1?
It would be useful and yes I guess having #1 would solves this
however I have a few remarks: It's a bit of a PITA to parse those env variable if you don't know the name or type of service that are linked. It can be done ( eg: https://github.com/texthtml/docker-links ) but even then you'll still have to write heuristics to guess which database type it is ( so it might not work with non official database that could use different variable or defaults)
anyway I guess it would mean making a plugin for adminer (I've made a similar plugin at work to automatically connect to our databases but reading a configuration file instead of env vars)
do you think we could find some easier way to configure theses connections?
eg, using DSN like :
docker run \
-e ADMINER_SOURCES=FIRST_DB,SECOND_DB \
-e ADMINER_SOURCE_FIRST_DB=mysql:host=mysql;port=3307;dbname=testdb;username=root \
-e ADMINER_SOURCE_SECOND_DB=pgsql:host=10.2.0.71;port=5432;dbname=testdb;user=bruce
clue/adminer
note, here is the env vars availlable when linking a mysql container to adminer:
docker exec adminer env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=8d7fa8843d12
MYSQL_PORT=tcp://172.17.0.2:3306
MYSQL_PORT_3306_TCP=tcp://172.17.0.2:3306
MYSQL_PORT_3306_TCP_ADDR=172.17.0.2
MYSQL_PORT_3306_TCP_PORT=3306
MYSQL_PORT_3306_TCP_PROTO=tcp
MYSQL_NAME=/adminer/mysql
MYSQL_ENV_MYSQL_ALLOW_EMPTY_PASSWORD=true
MYSQL_ENV_GOSU_VERSION=1.7
MYSQL_ENV_MYSQL_MAJOR=5.7
MYSQL_ENV_MYSQL_VERSION=5.7.12-1debian8
HOME=/root
depending on the situation even harder than the database it could be difficult to guess the username, password and database to use
I'm maybe wrong, but predefined connections are stored in session/cookie. Aren't they?
It would be nice to have an option for predefined list of DB connections, specified via environment variables on container start (or somehow), later shown in the UI on the login screen.
Similar to: