quarkiverse / quarkus-ngrok

ngrok is a globally distributed reverse proxy fronting your web services running in any cloud or private network, or your machine
https://docs.quarkiverse.io/quarkus-ngrok/dev/index.html
Apache License 2.0
7 stars 7 forks source link

supporting named tunnels #103

Closed maxandersen closed 7 months ago

maxandersen commented 7 months ago

ngrok have various config options that if we were to support them all would be quite tedious; but I still like being able to co-exist/co-evolve with what we see makes most sense.

in a recent PR #97 I added support for merging the configs - this allows users that have already setup auth key or other global options to "inherit" that from ngrok.

I was thinking we should allow that for the tunnel definition too. i.e. allow users to set in their default ngrok.yml (different location dependent on OS) settings per tunnelname.

what would happen is that instead of using ngrok http --domain=whatever.xyz --config generateconfig.yml,~/.config/ngrok.yml 8080 we would generate a tunnel definition in the generateconfig.yml we generate anyway for some settings that looks like this:

version: 2
tunnels:
  io.quarkus-myapp:
    proto: http
    hostname: conversely-just-gazelle.ngrok-free.app
    addr: 127.0.0.1:80

by default everything will just work as is - no config needed.

But if lets say I would wanna enable compression and add basic auth and only allow requests from certain IPs I would put the following in my ngrok.yml:

authtoken: mysecret
version: 2
tunnels:
 io.quarkus-myapp:
   compression: true
   ip_restriction.allow_cidrs: "::/0"

We can still add explicit support for every config in this extension but I don't feel like its good use of our time unless its a really a really nice and key config (like token and domain).

What I'm struggling to decide is wether we shuold just move to always generate the intermediate config file or we should do was do today and only generate the intermediate config file if user actually does some configuration that is needed and if not we just rely on the global ngrok tunnel config.

I'm leaning towards always generating the intermediate file and use a named tunnel (using quarkus app name as default name) but i can also see the advantages of not generating that file unless really needed.

any suggestion on preference?

melloware commented 7 months ago

i am leaning with you. Always generate the intermediate file.