wouterdebie / locast2tuner

Locast to Emby/Plex/Channels server
https://wouterdebie.github.io/locast2tuner/
MIT License
52 stars 8 forks source link

Moves config to TOML and /config.toml (#33) #35

Closed wouterdebie closed 3 years ago

wouterdebie commented 3 years ago

This commit moves the config file format from .ini to .toml, since it was parsed as TOML already anywa. The big difference however is that in the config file, override_zipcodes is no longer a comma-separated string, but has become an actual array.

So we went from:

override_zipcodes = "88488,90201"

to

override_zipcodes = ["88488", "90210"]

The main reason for this is that I added the /config.toml path to display the running configuration in the actual configuraion format. However, by serializing the config as TOML, the comma-separated string became an array. I realized that the config file wasn't proper .ini anyway, since .ini comments with ;, rather than '#', which confuses a bunch of editors.

So, here we standardize to actual TOML. Apart from the implementation, this commit also updates documentation and refers to config.toml rather than config.ini in other places (like startup scripts and Docker configuration).

However, old configurations will still work. I built in backwards compatibility for comma-separated config and old paths will still work.

wouterdebie commented 3 years ago

@eiddor @croq360 any comments on this?

eiddor commented 3 years ago

Looks good to me, @wouterdebie - I would put config.ini back in .gitignore just in case people copy instead of renaming theirs. Everything else makes sense. I didn't even know what TOML until just now.

Croq360 commented 3 years ago

Sure, I think this would be fine (especially since existing configs will still work). Curious as to why not JSON or YAML though...

wouterdebie commented 3 years ago

Rust comes with support for TOML out of the box and since it's a very readable and simple format, I think it fits well. I just removed all the .toml extensions from the paths, since users don't need to know that it's TOML and might get confused. It's mentioned in the documentation though.

eiddor commented 3 years ago

Nice! Curious question - Does .gitignore treat config.* the same way it treats config*?

wouterdebie commented 3 years ago

Nice! Curious question - Does .gitignore treat config.* the same way it treats config*?

No, it shouldn't.. that said, I messed up the .gitignore and config.* was ignored everywhere :)

eiddor commented 3 years ago

Haha I saw that. Oops! What I was actually wondering is if config will get ignored with config.*. More curious than anything.

wouterdebie commented 3 years ago

Nope :) Maybe it should be config*

On Tue, Apr 13, 2021 at 6:06 PM Roddie Hasan @.***> wrote:

Haha I saw that. Oops! What I was actually wondering is if config will get ignored with config.*. More curious than anything.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/wouterdebie/locast2tuner/pull/35#issuecomment-819107627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKABQ5RKTVFVQJ7SQDHSTTITE75ANCNFSM424BEVZQ .

eiddor commented 3 years ago

Yeah - I don't push from the same place I test from, but I'm sure one of these days one of us will put up their config accidentally haha, especially of we follow the doc.