Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "flag provided but not defined" #8

Open
schenklklopfer opened this issue Jan 6, 2025 · 1 comment
Open

Error: "flag provided but not defined" #8

schenklklopfer opened this issue Jan 6, 2025 · 1 comment

Comments

@schenklklopfer
Copy link

I try to start your tool providing username and password for my selfhosted ntfy instance.
All I get is this error: flag provided but not defined

I tried several things but the error is always the same.
Maybe I just do not understand how to set this settings correctly.

Here the docker-compose.yml parts I use:

...
  grafana-ntfy:
    image: academo/grafana-ntfy:latest
    restart: unless-stopped
    expose:
      - 8080 #only accesible to other containers
    networks:
      - metrics
    command:
      - "-username 'grafana' -password 'super-secure-pw' -ntfy-url 'https://selfhosted-ntfy-server.tld/grafana'"

The message I get in full term is:

flag provided but not defined: -username 'grafana' -password 'super-secure-pw' -ntfy-url 'https://selfhosted-ntfy-server.tld/grafana'
Usage of /usr/local/bin/grafana-ntfy:
  -addr string
    	The address to listen on (default ":8080")
  -allow-insecure
    	Allow insecure connections to ntfy-url
  -debug
    	print extra debug information
  -ntfy-url string
    	The ntfy url including the topic. e.g.: https://ntfy.sh/mytopic
  -password string
    	The ntfy password
  -port int
    	DEPRECATED. Use listenAddr. The port to listen on (default 8080)
  -username string
    	The ntfy username

What is wrong here?

@academo
Copy link
Owner

academo commented Jan 7, 2025

Hi there.

You are passing wrong the command, in docker-compose you need to pass each space-separated parameter as an element, so instead of (here you are passing a single big param with all the content inside escaped)

command:
      - "-username 'grafana' -password 'super-secure-pw' -ntfy-url 'https://selfhosted-ntfy-server.tld/grafana'"

you should use

    command:
      - "-username"
      - "grafana"
      - "-password"
      - "super-secure-pw"
      - "-ntfy-url"
      - "https://selfhosted-ntfy-server.tld/grafana"

or you can also not use an array for the command and pass a string directly

    command: -username grafana -password super-secure-pw -ntfy-url https://selfhosted-ntfy-server.tld/grafana

You can see how it works in the docker docs

I tried those commands I gave you here locally and they all work fine

I also updated the readme to avoid confusing people with the format in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants