blue-yonder / bonfire

A CLI Graylog Client with Follow Mode
BSD 3-Clause "New" or "Revised" License
72 stars 26 forks source link

Endpoint #18

Closed emillynge closed 7 years ago

emillynge commented 8 years ago

From http://docs.graylog.org/en/latest/pages/configuration/web_interface.html?highlight=endpoint#single-or-separate-listeners-for-web-interface-and-rest-api

Since Graylog 2.1 you have two options when it comes to exposing its web interface:

Running both on the same port, using different paths (defaulting to http://localhost:9000/api/ for the REST API and http://localhost:9000/ for the web interface), this is the default since 2.1 and is assumed for most parts of the documentation. Running on two different ports (for example http://localhost:12900/ for the REST API and http://localhost:9000/ for the web interface)

In order to use the setup with just one exposed port bonfire has to include a new parameter "--end-point" atm. I have set this parameter to be None by default. A better option might be "/" or "/api". Additionally the ~/.bonfire.cfg in REAMDE.rst should maybe show examples using both of the above methods.

In this PR I have also included GraylogAPI.__str__ which shows a truncated API url

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-1.1%) to 78.819% when pulling a6d108e8a07c238abb424670c0e45f692c2de23a on emillynge:endpoint into c327668adcad9e238e3416c05f0c678e1b444848 on blue-yonder:master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.3%) to 80.208% when pulling efc695e034fae1986bce5e0693cc48b5a1694f0b on emillynge:endpoint into c327668adcad9e238e3416c05f0c678e1b444848 on blue-yonder:master.

mahrz24 commented 8 years ago

Thanks, that looks good! I am somehow tending to use "endpoint" instead of "end-point", or is there a good point for one of them?

emillynge commented 8 years ago

hmmm... Accordin to google endpoint is 2-3 times more widespread than end-point. And graylog in their documentation uses "endpoint", i think that there is definitely an argument for using that.

lemme just commit a change that uses endpoint...

coveralls commented 8 years ago

Coverage Status

Coverage increased (+4.8%) to 84.775% when pulling 81e85600cddb11a656160c484165838cbd4daeab on emillynge:endpoint into c327668adcad9e238e3416c05f0c678e1b444848 on blue-yonder:master.

emillynge commented 8 years ago

So I did i few more thing while in the code: PEP8 some stuff (mostly missing newlines and a couple of very log function definitions)

Use "entrypoint" all around.

make the default entrypoint "/". After some thought, entrypoint=None made no sense. It's still an entrypoint, it just happens to be at the root.

emillynge commented 8 years ago

The tests not passing seems to be a sporadic test failure due to some imprecision/race condition. When testing locally I get a fail on that test appr. once every 3 times.

emillynge commented 7 years ago

bumping @mahrz :)