jadahl / mod_restful

RESTful interface to ejabberd
84 stars 34 forks source link

can you offer a yaml config example? #19

Open lpisces opened 10 years ago

lpisces commented 10 years ago

thank you ~

jadahl commented 10 years ago
  mod_restful:
    api:
      - path: ["admin"]
        module: mod_restful_admin
        params:
          key: "secret"
          allowed_commands: [register, unregister]
      - path: ["register"]
        module: mod_restful_register
        params:
          key: "secret"
zhangzhang commented 9 years ago

Could you please help me with the listener configuration in yaml as well?

jadahl commented 9 years ago

@zhangzhang, here you go:

listen:
  -
    port: 8088
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/api": mod_restful
zxcfer commented 9 years ago

Proposed YAML configuration is not working for me, any ideas?

2015-09-11 02:27:16.367 [critical] <0.37.0>@gen_mod:start_module:107 Problem starting the module mod_restful for host <<"fernando">> 
 options: [{api,[[{path,[<<"admin">>]},
                  {module,mod_restful_admin},
                  {params,[{key,<<"secret">>},
                           {allowed_commands,[register,unregister]}]}],
                 [{path,[<<"register">>]},
                  {module,mod_restful_register},
                  {params,[{key,<<"secret">>}]}]]}]
 error: undef
[{mod_restful,start,
              [<<"fernando">>,
               [{api,[[{path,[<<"admin">>]},
                       {module,mod_restful_admin},
                       {params,[{key,<<"secret">>},
                                {allowed_commands,[register,unregister]}]}],
                      [{path,[<<"register">>]},
                       {module,mod_restful_register},
                       {params,[{key,<<"secret">>}]}]]}]],
              []},
 {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,99}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1336}]},
 {ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,72}]},
 {application_master,start_it_old,4,
                     [{file,"application_master.erl"},{line,272}]}]
2015-09-11 02:27:16.368 [critical] <0.37.0>@gen_mod:start_module:112 ejabberd initialization was aborted because a module start failed.
jadahl commented 9 years ago

@lwxfer Could it be that ejabberd can't find your compiled .beam files?

zxcfer commented 9 years ago

Worked pretty fine, but I had to change ip to 0.0.0.0

listen:
  -
    port: 8088
    ip: "0.0.0.0"
    module: ejabberd_http
    request_handlers:
      "/api": mod_restful