-
Notifications
You must be signed in to change notification settings - Fork 87
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
Config system #26
base: master
Are you sure you want to change the base?
Config system #26
Conversation
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.
Haven't had time to do a full review. I'll post what I have now.
Also, I don't think we need the JSON reader if we have one for INI. Though it may be worth keeping around. I don't know. I am too sleepy. :)
cmd/grumble/freeze.go
Outdated
@@ -835,7 +834,7 @@ func (server *Server) UpdateFrozenBans(bans []ban.Ban) { | |||
} | |||
|
|||
// Write an updated config value to the datastore. | |||
func (server *Server) UpdateConfig(key, value string) { | |||
/*func (server *Server) UpdateConfig(key, value string) { |
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.
Feel free to remove. We can restore from history if necessary.
cmd/grumble/freeze.go
Outdated
|
||
// Write to the freezelog that the config with key | ||
// has been reset to its default value. | ||
func (server *Server) ResetConfig(key string) { | ||
/*func (server *Server) ResetConfig(key string) { |
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.
Feel free to remove. We can restore from history if necessary.
I don't mind whether you keep the JSON support or not. If there is no use-case for it we could just drop it. |
cmd/grumble/args.go
Outdated
@@ -30,6 +30,20 @@ var usageTmpl = `usage: grumble [options] | |||
--log <log-path> (default: $DATADIR/grumble.log) | |||
Log file path. | |||
|
|||
--config, --ini <config-path> (default: $DATADIR/grumble.ini) |
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.
murmur doesn't have --config, only --ini, so let's drop it from here
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.
--ini by itself wouldn't make sense if we had multiple formats (although it should still be there for murmur compatibility), but we won't right now, so I'll get rid of it
pkg/serverconf/cipherlist.go
Outdated
if ok { | ||
ciphers = append(ciphers, c) | ||
} else { | ||
log.Printf("Ignoring invalid or unsupported cipher \"%v\"", v) |
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.
I dont like the log in this function. If you need to report in this, make the function a multi-return that contains the unsupported values.
pkg/serverconf/file.go
Outdated
switch filepath.Ext(path) { | ||
case ".ini": | ||
f, err = newinicfg(path) | ||
case ".json": |
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.
drop json support
pkg/serverconf/file.go
Outdated
func NewConfigFile(path string) (*ConfigFile, error) { | ||
var f cfg | ||
var err error | ||
switch filepath.Ext(path) { |
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.
don't require the config file have a particular extension, just always parse as ini
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.
As per #21 I'll still keep the multiple-format boilerplate around (separate NewConfigFile
from newinicfg
). Please tell me if you think I should get rid of it as well.
pkg/serverconf/file_ini.go
Outdated
if !f.murmurCompat { | ||
return f.file.Section("").KeysHash() | ||
} else { | ||
return TranslateMurmur(f.file.Section("").KeysHash()) |
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.
i think it would be preferable if the ini file had as many common fields with the murmur config as possible. Can we rename all config values appropriately (e.g. Address -> host)
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.
There are a few reasons I didn't do this.
- Backwards compatibility with previous grumble freezes. The current way supports both the previous/current grumble key names and the previous murmur key names. (I don't know if this matters, and I actually accidentally broke it by renaming MaxChannelUsers to MaxUsersPerChannel. Oops! Fixing that when I have time to write a patch.)
- I want a TranslateMurmur step and a list of supported murmur keys anyway to print messages regarding common unsupported configuration. (It also strips unsupported keys as to not pollute the freeze files, but that will be unnecessary later, see below.)
- Subjective: My interpretation of Introduce compatibility with Murmur .ini files #21 is that the murmur support should be a non-default personality. (I chose to trigger it if the config file is named murmur.ini, but other solutions are possible, too.) This means that the normal configuration isn't dependent on murmur, so there's no guarantee everything works the same way in normal mode. (However, the murmur mode instead promises compatibility -- two sides of the same coin.) This means there is no need to rename things like Address either (it's had that name for 7 years). Rather, murmur configuration should be converted.
Because of the freeze persistence, grumble still wouldn't behave like murmur when you try to reconfigure murmur.ini to defaults. I didn't have time to fix that just yet, but I want the config to not persist in the freeze (overriding defaults, but not config set through future RPC).
This obviously does not preclude renaming the new keys closer to their murmur counterparts (like TLS* to SSL*, *Path to *File etc.), and fixing the persisting configs are on my to-do list. Even if you're not convinced about the field names, I'd still like to hear what you think about the translation/filter step.
pkg/serverconf/file_json.go
Outdated
@@ -0,0 +1,154 @@ | |||
package serverconf |
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.
delete file
pkg/serverconf/murmurcompat.go
Outdated
"log" | ||
) | ||
|
||
var murmurCompatRules = map[string]string{ |
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.
like mentioned above, drop this (file); use common names with murmur
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.
See above.
Sorry for leaving this be. I'll quickly sketch up my thoughts on the personalities in Grumble: I think the code we're working with now should just be "grumble". If we do implement personalities, they'd probably be a separate command (separate package main). That seems cleaner to me. The way I imagine it would pan out is that we refactor the Server part into a package, with the hooks necessary to implement custom handling. Anyway, in my mind, since Murmur doesn't have config files at the moment, we should probably just use the Murmur .ini format all the way through. I guess that does make some sense: Grumble, as it is right now has no way to set config options. (I removed my JSON-RPC thing and/or SSH thing I had for a while). |
"path/filepath" | ||
"strconv" | ||
|
||
"gopkg.in/ini.v1" |
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.
Getting a build error on this line, no package found
Sorry for being inactive. I've been busy with other stuff and the ACME spec doesn't seem to be making a lot of progress anyway. I had some patches on my computer waiting for consensus that I am uploading now. Seems like I am outvoted on the CamelCase point so I've dropped the compatibility layer design entirely and made grumble.ini configuration a superset of murmur.ini. (I still left some convenience features enabled in the .ini parser regarding quote escaping and boolean keys etc.). I did keep the warnings for unsupported common Murmur configuration around but they are separate and easily removed now if you don't want them. The branch history is a bit long now but I want to avoid rewriting the commits with issue mentions until the squash and merge. |
Is @mkrautz waiting for changes by @rubenseyer here, still? I only mean well. Looks like this PR could solve a number issues related to not having a proper configuration file system in place! |
Sorry to ask, but is there any news on this? I am about to setup a mumble server again, and would really like to use Grumble. |
Given this PR is a few years out of date, if you would like to rebase it on master and give it a test that would be awesome. If I have time this weekend I can take a look myself. |
Would be awesome if you could have a look at it. |
Wow, I had forgotten about this! I'm still around, but probably too busy to do anything too soon. I'll try to rebase and update everything if I get time and no one else beats me. Looking through what has happened since I'm gone, here's a few things off the top of my head:
Sorry for dropping a book on you, but I thought I'd write down some of these considerations so we can think about the decisions involved. Merging this is not far away in terms of code changes but it is an entirely new part to Grumble so it was always gonna be a matter of design problems first and foremost. |
It sounds like this PR brings up a bunch of questions that we should figure out the best way to handle.
|
I think my views on this have remained unchanged since I first began this PR --- in essence, I agree. I think that for Grumble to become a default choice we will need compatibility to allow easy migration (but compatibility need not mean that we enforce Grumble to have exactly the same feature set as Murmur). My solution for that was the translation layer which was a compromise between not breaking existing Grumble servers and allowing compatibility with existing configuration, because I have no problem with the real Grumble config not being exactly the same as murmur.ini (and apparently neither did the original author of (Also, we clearly would need gRPC for any major production user to consider switching. That was my idea for the next step after this PR back in 2018.) |
(see also issue mumble-voip#21) Removes synchronizing set config keys to freezelog, since the system is the preferred way to persist configuration.
1ae1f08
to
d7a0c46
Compare
I rebased everything and re-organized the slew of WIP commits into something more logical. I have changed no design decisions here compared to where I left off in 2018, so I do not expect this to be merged until everyone is satisfied on those. Please do test and review the changes, because I have only built it and nothing more. Some notes:
|
Also adds some Murmur CLI flags, see mumble-voip#25 Since the only way right now to set the SuperUser pw is through the CLI on start, this commit also drops the config updates through the freezelog (probably a remnant of RPC), which the SetSuperUserPassword function was the last user of.
MaxUsers: modifies existing sessionpool similar to Murmur MaxUsersPerChannel: already implemented, inconsistent name AllowPing: affects registration, too DefaultChannel RememberChannel ServerPassword SendOSInfo: already implemented, inconsistent name Config keys are renamed to conform to murmur.ini
I get this error on first start. The message is also missing a "\n". |
I'm not able to add
|
I can reproduce the same crash on both master and this PR:
I have filed PR #71 to fix it, because it is not really pertinent to this one (which is bogged down in years of reviews anyway). You should be able to easily rebase those changes onto this one if you want to combine them immediately -- this shouldn't touch those areas too much. I'll rebase here later if the other one is merged. |
Alright, so here's my suggestion for what the config system could look like. Sorry for being a bit spammy with the issue mentions--I didn't expect them to show up while I was still tidying history. I'm holding off on the Let's Encrypt implementation because I want to see how the
tls-sni
debacle ends before adding another HTTP server just to respond to the challenge.serverconf
based on string maps. It is format independent - if it can encode string key-value pairs (and has a file format extension) it can be a config format.If the config file is named murmur.ini an additional translation step is performed, including warnings for some unsupported features (but I won't promise I catch all of them). (The .ini support uses go-ini.)but I quickly implemented it anyway to showcase the format independence. However, it would probably require a few good test cases for me to be confident it's usable.The freeze system still acts as the persistent storage, which means that to revert a config value to defaults, you can't just comment it out, you have to specify it unset. I think this is an acceptable compromise.The config system introduces one new feature: if the config format supports some form of subsets (sections in .ini, nested objects in .json) it is possible to set specific overrides for single virtual servers (including reverting to defaults). Not the best form of virtual server management, but at least it's something.To make this meaningful, I also implemented some missing config keys that users migrating from Murmur probably would want. Features like databases, RPC and bandwidth limiting are still missing (but the latter should probably wait for web client support). I also added the SuperUser CLI flags from Murmur. I think the remaining unimplemented Murmur CLI flags would be meaningless for Grumble right now, at least.