TimWolla / docker-adminer

Database management in a single PHP file
https://hub.docker.com/_/adminer/
157 stars 69 forks source link

Can't load custom plugin #66

Closed ghost closed 4 years ago

ghost commented 4 years ago

I want to load a custom plugin, but the container crashes everytime.

Here is my docker-compose

version: "3.7"

services:
  service-postgresql:
    container_name: container-postgresql
    image: postgres:latest
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_PASSWORD=my-pass
      - POSTGRES_USER=my-user
      - POSTGRES_DB=my-db

service-adminer:
    container_name: container-adminer
    image: adminer:fastcgi
    depends_on:
      - service-postgresql
    volumes:
      - ./my-path-to-folder/Adminer/plugins-enabled/login-servers.php:/var/www/html/plugins-enabled/login-servers.php:ro
    environment:
      - ADMINER_DEFAULT_SERVER=service-postgresql
      - ADMINER_PLUGINS=login-servers

service-nginx:
    container_name: container-nginx
    image: nginx
    depends_on:
      - service-adminer
    ports:
      - "80:80"
    volumes:
      - /my/path/conf.d:/etc/nginx/conf.d:ro

./my-path-to-folder/Adminer/plugins-enabled/login-servers.php

<?php
require_once('plugins/login-servers.php');

return new AdminerLoginServers([
    'PostgreSQL' => [
        'server' => $_ENV['ADMINER_DEFAULT_SERVER'],
        'driver' => 'pgsql'
    ]
]);

Crash log

Unable to load plugin file "login-servers", because it has required parameters: servers
Create a file "/var/www/html/plugins-enabled/login-servers.php" with the following contents to load the plugin:

<?php
require_once('plugins/login-servers.php');

/** Set supported servers
    * @param array array($description => array("server" => , "driver" => "server|pgsql|sqlite|..."))
    */
return new AdminerLoginServers(
    $servers = ???
);

Somebody can tell me what I'm doing wrong?

Thanks in advance!

TimWolla commented 4 years ago

Somebody can tell me what I'm doing wrong?

Remove the plugin from the ADMINER_PLUGINS environment variable, because you are loading it manually.

ghost commented 4 years ago

Remove the plugin from the ADMINER_PLUGINS environment variable, because you are loading it manually.

Thanks!

Solved.