From c4191993c1f0a749240fad8490b9a7c42eb9965a Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 10 Jan 2022 16:32:13 -0600 Subject: [PATCH] Update parameter names to match phpipam-docker project --- Dockerfile | 16 ++++++++-------- README.md | 36 ++++++++++++++++++------------------ entrypoint.sh | 2 +- example-docker-compose.yml | 20 ++++++++++---------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62baa09..d5f1651 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,15 +39,15 @@ RUN git clone ${PHPIPAM_AGENT_SOURCE}.git WORKDIR /opt/phpipam-agent # Use system environment variables into config.php RUN cp config.dist.php config.php && \ - sed -i -e "s/\['key'\] = .*;/\['key'\] = getenv(\"PHPIPAM_AGENT_KEY\");/" \ + sed -i -e "s/\['key'\] = .*;/\['key'\] = getenv(\"IPAM_AGENT_KEY\");/" \ -e "s/\['pingpath'\] = .*;/\['pingpath'\] = \"\/usr\/sbin\/fping\";/" \ - -e "s/\['reset_autodiscover_addresses'\] = false/\['reset_autodiscover_addresses'\] = getenv(\"PHPIPAM_RESET_AUTODISCOVER\") ?: false/" \ - -e "s/\['remove_inactive_dhcp'\].*= false/\['remove_inactive_dhcp'\] = getenv(\"PHPIPAM_REMOVE_DHCP\") ?: false/" \ - -e "s/\['db'\]\['host'\] = \"localhost\"/\['db'\]\['host'\] = getenv(\"PHPIPAM_DB_HOST\")/" \ - -e "s/\['db'\]\['user'\] = \"phpipam\"/\['db'\]\['user'\] = getenv(\"PHPIPAM_DB_USER\") ?: \"phpipam\"/" \ - -e "s/\['db'\]\['pass'\] = \"phpipamadmin\"/\['db'\]\['pass'\] = getenv(\"PHPIPAM_DB_PASS\")/" \ - -e "s/\['db'\]\['name'\] = \"phpipam\"/\['db'\]\['name'\] = getenv(\"PHPIPAM_DB_NAME\") ?: \"phpipam\"/" \ - -e "s/\['db'\]\['port'\] = 3306/\['db'\]\['port'\] = getenv(\"PHPIPAM_DB_PORT\") ?: 3306/" \ + -e "s/\['reset_autodiscover_addresses'\] = false/\['reset_autodiscover_addresses'\] = getenv(\"IPAM_RESET_AUTODISCOVER\") ?: false/" \ + -e "s/\['remove_inactive_dhcp'\].*= false/\['remove_inactive_dhcp'\] = getenv(\"IPAM_REMOVE_DHCP\") ?: false/" \ + -e "s/\['db'\]\['host'\] = \"localhost\"/\['db'\]\['host'\] = getenv(\"IPAM_DATABASE_HOST\")/" \ + -e "s/\['db'\]\['user'\] = \"phpipam\"/\['db'\]\['user'\] = getenv(\"IPAM_DATABASE_USER\") ?: \"phpipam\"/" \ + -e "s/\['db'\]\['pass'\] = \"phpipamadmin\"/\['db'\]\['pass'\] = getenv(\"IPAM_DATABASE_PASS\")/" \ + -e "s/\['db'\]\['name'\] = \"phpipam\"/\['db'\]\['name'\] = getenv(\"IPAM_DATABASE_NAME\") ?: \"phpipam\"/" \ + -e "s/\['db'\]\['port'\] = 3306/\['db'\]\['port'\] = getenv(\"IPAM_DATABASE_PORT\") ?: 3306/" \ config.php \ \ && chmod +x /entrypoint.sh \ diff --git a/README.md b/README.md index de2d846..8ba5883 100644 --- a/README.md +++ b/README.md @@ -42,30 +42,30 @@ services: restart: unless-stopped image: jbowdre/phpipam-agent:latest environment: - - PHPIPAM_DB_HOST=ipamhost.local - - PHPIPAM_DB_NAME=phpipam - - PHPIPAM_DB_USER=phpipam - - PHPIPAM_DB_PASS=phpipamadmin - - PHPIPAM_DB_PORT=3306 - - PHPIPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb - - PHPIPAM_SCAN_INTERVAL=15m - - PHPIPAM_RESET_AUTODISCOVER=false - - PHPIPAM_REMOVE_DHCP_false + - IPAM_DATABASE_HOST=ipamhost.local + - IPAM_DATABASE_NAME=phpipam + - IPAM_DATABASE_USER=phpipam + - IPAM_DATABASE_PASS=phpipamadmin + - IPAM_DATABASE_PORT=3306 + - IPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb + - IPAM_SCAN_INTERVAL=15m + - IPAM_RESET_AUTODISCOVER=false + - IPAM_REMOVE_DHCP_false - TZ=UTC ``` ## Configuration Parameters | Parameter | Description | | --- | --- | -| `PHPIPAM_DB_HOST` | IP/FQDN where the phpIPAM database is running | -| `PHPIPAM_DB_NAME` | Name of the database on the host *(Optional; default: `phpipam`)* | -| `PHPIPAM_DB_USER` | Database user with required privileges *(Optional; default: `phpipam`)* | -| `PHPIPAM_DB_PASS` | Password for that user | -| `PHPIPAM_DB_PORT` | Port number for the database listener *(Optional; default: `3306`)* | -| `PHPIPAM_AGENT_KEY` | Unique key generated by phpIPAM for each scan agent | -| `PHPIPAM_SCAN_INTERVAL` | How frequently the Status and Discovery scans will run (Valid options: `5m`, `10m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `12h`) *(Optional; default: `15m`)* | -| `PHPIPAM_RESET_AUTODISCOVER` | Enable the agent to remove autodiscovered IPs which are offline *(Optional; default: `false`)* | -| `PHPIPAM_REMOVE_DHCP` | Enable the agent to remove inactive DHCP addresses *(Optional; default: `false`)* | +| `IPAM_DATABASE_HOST` | IP/FQDN where the phpIPAM database is running | +| `IPAM_DATABASE_NAME` | Name of the database on the host *(Optional; default: `phpipam`)* | +| `IPAM_DATABASE_USER` | Database user with required privileges *(Optional; default: `phpipam`)* | +| `IPAM_DATABASE_PASS` | Password for that user | +| `IPAM_DATABASE_PORT` | Port number for the database listener *(Optional; default: `3306`)* | +| `IPAM_AGENT_KEY` | Unique key generated by phpIPAM for each scan agent | +| `IPAM_SCAN_INTERVAL` | How frequently the Status and Discovery scans will run (Valid options: `5m`, `10m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `12h`) *(Optional; default: `15m`)* | +| `IPAM_RESET_AUTODISCOVER` | Enable the agent to remove autodiscovered IPs which are offline *(Optional; default: `false`)* | +| `IPAM_REMOVE_DHCP` | Enable the agent to remove inactive DHCP addresses *(Optional; default: `false`)* | ## Logging The logs are available on stdout/stderr (allowing to use `docker logs`). diff --git a/entrypoint.sh b/entrypoint.sh index a810f44..f3317cc 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -case "$PHPIPAM_SCAN_INTERVAL" in +case "$IPAM_SCAN_INTERVAL" in 5m) CRON_S="*/5 *" ;; 10m) CRON_S="*/10 *" diff --git a/example-docker-compose.yml b/example-docker-compose.yml index 35b7d6a..5f0ce2b 100644 --- a/example-docker-compose.yml +++ b/example-docker-compose.yml @@ -3,15 +3,15 @@ services: phpipam-agent: container_name: phpipam-agent restart: unless-stopped - image: jbowdre/phpipam-agent:latest + image: ghcr.io/jbowdre/phpipam-agent:latest environment: - - PHPIPAM_DB_HOST=ipamhost - - PHPIPAM_DB_NAME=phpipam - - PHPIPAM_DB_USER=phpipam - - PHPIPAM_DB_PASS=phpipamadmin - - PHPIPAM_DB_PORT=3306 - - PHPIPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb - - PHPIPAM_SCAN_INTERVAL=15m - - PHPIPAM_RESET_AUTODISCOVER=false - - PHPIPAM_REMOVE_DHCP=false + - IPAM_DATABASE_HOST=ipamhost + - IPAM_DATABASE_NAME=phpipam + - IPAM_DATABASE_USER=phpipam + - IPAM_DATABASE_PASS=phpipamadmin + - IPAM_DATABASE_PORT=3306 + - IPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb + - IPAM_SCAN_INTERVAL=15m + - IPAM_RESET_AUTODISCOVER=false + - IPAM_REMOVE_DHCP=false - TZ=UTC