kilmajster / ngrok-spring-boot-starter

🚀 Spring Boot tunneling with Ngrok made easy! No matter if you are using Windows, Mac OS X, Linux or even Docker - ngrok binary will be chosen automatically 🤖 so you don't need to care about environment changing etc. auto-configuration magic 🧙‍♂️
MIT License
128 stars 17 forks source link

Add documentation about @NgrokComponent #49

Open juherr opened 3 years ago

juherr commented 3 years ago

Hi,

Thanks for your starter which is working well 👍 Sadly, there is missing some documentation about @NgrokComponent.

For example, I had to dig into the sources in order to find how to find the publicUrl.

The solution is quite easy but undocumented:

    @Autowired 
    private NgrokApiClient ngrok;

    ...
    String publicUrl = ngrok.fetchTunnels().first { it.proto == "http" }.publicUrl
kilmajster commented 3 years ago

Hi @juherr :smiley: thanks for pointing this out. I am planning to extend this bean to cover all ngrok API methods (and then create some serious documentation). I can image that accessing public ngrok URL in most cases is all what user want to do with API so for now in v0.3.4 I added getters for public http and https URLs, please check https://github.com/kilmajster/ngrok-spring-boot-starter#ngrok-api

juherr commented 3 years ago

Awesome 👍

returns http(s) tunnel URL or null in case ngrok is not running

It is opinionated, but I think an exception will be better than null because you are not supposed to call it if not running. Maybe you'll have to add something like boolean isRunning() too.