-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
I figured how to auto-login, if you want you could add this to the Docker Hub docs. Basically it just automates the login form (this worked out the best).
compose.yaml:
services:
postgres:
image: postgres:18
# ...
adminer:
image: adminer:5
ports:
# ...
volumes:
- ./adminer-custom.php:/var/www/html/index.php:ro
depends_on:
postgres:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"php",
"-r",
"exit(file_get_contents('http://localhost:8080/') ? 0 : 1);",
]
start_period: 10s
interval: 30s
timeout: 10s
retries: 3adminer-custom.php:
<?php
// See https://www.adminer.org/en/extension/
// What worked best is to just simply override the login form.
function adminer_object() {
class MyDbLocalAdminer extends Adminer\Adminer {
function loginForm() {
echo Adminer\input_hidden('auth[driver]', 'pgsql');
echo Adminer\input_hidden('auth[server]', 'postgres');
echo Adminer\input_hidden('auth[username]', 'mydb-local');
echo Adminer\input_hidden('auth[password]', 'mydb-local');
echo Adminer\input_hidden('auth[db]', 'mydb-local');
echo Adminer\script("document.querySelector('form').submit();");
}
}
return new MyDbLocalAdminer;
}
include '/var/www/html/adminer.php';Kudos to Claude for vibing (don't worry, I cleaned it up).
Tested on latest Firefox, Brave, Chrome, Edge.
Metadata
Metadata
Assignees
Labels
No labels