albertodonato / query-exporter

Export Prometheus metrics from SQL queries
GNU General Public License v3.0
436 stars 101 forks source link

Add option to change config file path #158

Closed BoKKeR closed 7 months ago

BoKKeR commented 1 year ago

Is your feature request related to a problem? Please describe. Currently to my knowledge there is no way to mount a file from a named volume with docker-compose.

---
version: "3"
services:      
  sqlite_exporter:
    image: adonato/query-exporter:latest
    volumes: 
      - "rss_sqlite_exporter/config.yaml:/config.yaml"

volumes:
  rss_sqlite_exporter:
    external: true
Failure
Ignoring unsupported options: restart service sqlite_exporter: undefined volume "rss_sqlite_exporter/config.yaml"

Describe the solution you'd like I would prefer to be able to change the config file location, this way I could move it to a folder and mount the named volume as a folder. The path could be set with an env variable as -e CONFIG_PATH="/config/config.yaml"

Describe alternatives you've considered Mounting the file from the node-s filesystem works perfectly fine, but its NOT a great solution since named volumes are meant to prevent us from polluting the nodes filesystem.

    volumes: 
      - "/tmp/config.yaml:/config.yaml"
albertodonato commented 8 months ago

This is technically a simple change, the main issue with switching to a volume is that it has to point to a directory, which means it's a breaking change, given that currently just a file is mounted.

I think it still makes sense to do it, though.

BoKKeR commented 8 months ago

There could be an environmental variable to change the location of the file.