-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow simple remote configuration files #565
Conversation
Hm. Something about the Will investigate more later |
Also, with the "watching" approach, I don't think it's quick enough in the reload to know when to reload the channels, but we can prob just add in a large wait before sending the reconnect event through the gateways. At least that's my theorizing until I have time to try :) |
Ah, ok, I think I found the real way: Using |
Hm. Or maybe the right approach is to give the router a way to shut down, and just create a new Router object from scratch? I'll admit that I can't figure out how to get everything to reload -- like the viper config is reloading, but it seems there's lots of state in the router/gateways that I don't know how to refresh Any advice is appreciated! |
Ok, I'm certain this is wrong, but I'm just pushing that last commit to start a conversation -- I really don't feel like I know a whole lot about how to do this elegantly...! |
For now don't add any extra features to this PR, only reloading via remote URLs.
Yes that's correct, that's how it's implement, only the |
So to confirm my understanding, updating of channels bridged to gateways (adding and removing them) is out of scope for this PR? |
Yes, that's a bigger change with a lot of impact, I'd like to keep the PR's small |
a0799e7
to
775af76
Compare
775af76
to
ca5696c
Compare
ok right on. this one's ready for review. Tested it with some reloadable settings and works fine |
I'm wondering, I think it's better to remove the
|
I'm down for that, but if we do that, I think we should enforce a Token for the API bridge and fail out if it's not set. Would that be fair? |
On second thought... I know we're not building anything super-secure or privacy-minded here, but using POST data to set config url feels like unnecessary exposure... Can we allow environment variables too? As in, if someone knows that their config will always be at one spot, there's no need to add that extra level of exposure, if that makes sense :) |
Well, talking about secure or privacy, the URL where you're exposing your configuration on is a greater risk if it's not on https or protected because that contains all your tokens/logins/passwords. What do you mean by environment variables ? Another option is that instead of the URL, you just post the whole actual config to the endpoint. We should also add TLS support to the API (a new PR, not in this one! :), the original use-case was only for localhost and not meant to be available for the whole internet. |
Sorry, I don't understand: The tokens and any secrets are stored in environment variables on the matterbridge server (eg.
As in, setting MATTERBRIDGE_CONFIGURL will set the config url firmly from the server, so POSTing can't load any config file, but just reload the one pre-defined on the server. And good call on TLS! |
Ok that wasn't clear to me, could you please write some examples about this on the wiki too, because this feature will be used wrong by users :) |
Can do :) And I should test with BasicAuth before we merge. Also, can we leave the "config file in payload" for anther PR? It's a feature that might be worth putting in, but it doesn't feel necessary to have it this PR, since this is already functional for a set of use-cases |
@@ -82,6 +86,40 @@ func (b *Api) handleHealthcheck(c echo.Context) error { | |||
return c.String(http.StatusOK, "OK") | |||
} | |||
|
|||
func (b *Api) handleConfigReload(c echo.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method Api.handleConfigReload
has 6 return statements (exceeds 4 allowed).
Code Climate has analyzed commit 4e5a1f7 and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
487572a
to
426aa33
Compare
I don't think there is going to be any further work on this PR? |
Another run at #525
Curious about feedback to approach, but still needs work:
Notes:
ConfigURL
, as it's global and never bridge-specific.If it's alright with you Wim, I'll do the rest of the docs inline once Swagger
PR is merged?
Related: #244