docker-ejabberd icon indicating copy to clipboard operation
docker-ejabberd copied to clipboard

Where does "ejabberdapi" comes from?

Open mikegleasonjr opened this issue 5 years ago • 1 comments

I built an image for arm. The image works but I want to also compile ejabberdapi.

I thought it would be https://github.com/processone/ejabberd-api so I compiled it and injected it in the image in another stage of the multi-stage build... It works fine.

But the command line switches does not match the examples in the docker README:

$ ~/bin ./ejabberdapi register --endpoint=http://127.0.0.1:5280/ --jid=admin@localhost --password=passw0rd
ejabberdapi: error: unknown long flag '--endpoint', try --help
$ ~/bin ./ejabberdapi register --jid=admin@localhost --password=passw0rd
ejabberdapi: error: could not load token file ".ejabberd-oauth.json": open .ejabberd-oauth.json: no such file or directory

mikegleasonjr avatar Apr 10 '20 21:04 mikegleasonjr

I want to also compile ejabberdapi. I thought it would be https://github.com/processone/ejabberd-api

Well, the ejabberdapi binary included here should be obtained from https://github.com/processone/ejabberd-api and compiled with

go get -v github.com/processone/ejabberd-api/cmd/ejabberd

But the command line switches does not match the examples in the docker README:

I see that the endpoint option is placed as an app option, instead of token option. That was changed in https://github.com/processone/ejabberd-api/commit/b52950338cab65a48cc7be48242531eb4bcfc867

Compare the results when getting all the configurable options with --help-long. I get this after compiling it:

$ ./ejabberd --help-long
usage: ejabberd [<flags>] <command> [<args> ...]

A command-line front-end for ejabberd server API.

Flags:
      --help     Show context-sensitive help (also try --help-long and --help-man).
      --version  Show application version.
  -f, --file=".ejabberd-oauth.json"  
                 OAuth token JSON file.
      --json     JSON formatted output

Commands:
  help [<command>...]
    Show help.


  token --jid=JID [<flags>]
    Request an OAuth token.

    -j, --jid=JID              JID of the user to generate token for.
    -p, --password=PASSWORD    Password to use to retrieve user token.
    -P, --prompt               Prompt for password.
    -s, --scope="sasl_auth"    Comma separated list of scope to associate to token
    -t, --ttl=8760h            Time before token expiration. Valid unit time are second (s), minutes (m), hours (h)
    -e, --endpoint="http://localhost:5281/"  
                               ejabberd API endpoint.
        --oauth-url="/oauth/"  Oauth suffix for oauth endpoint.

  stats <name>
    Get ejabberd statistics.


  register --jid=JID --password=PASSWORD
    Create a new user.

    -j, --jid=JID            JID of the user to create.
    -p, --password=PASSWORD  Password to set for created user.

  user [<flags>] <operation>
    Operations to perform on users.

    -j, --jid=JID  JID of the user to perform operation on.

  offline [<flags>] <operation>
    Operations to perform on offline store.

    -j, --jid=JID  JID of the user to perform operation on, if different from token owner

  call --name=NAME [<flags>]
    Call a command on ejabberd server, using your token credentials.

        --data-file=DATA-FILE  File with JSON data to send to ejabberd. You can also use /dev/stdin
        --data=DATA            File with JSON data to send to ejabberd. Omit to read from STDIN
    -n, --name=NAME            Name of command on server
    -a, --admin                Call as admin

badlop avatar Mar 30 '21 18:03 badlop

Since this recent PR, the ejabberdapi binary is not included in the docker-ejabberd git repository. Instead, that binary is compiled when the container image is being built.

badlop avatar Jun 20 '23 11:06 badlop