tellytv / telly

An IPTV proxy
MIT License
760 stars 104 forks source link

telly can't find config file if launched from another location #176

Closed chazlarson closed 6 years ago

chazlarson commented 6 years ago

telly release with the issue:

version=1.1.0.2

Last working telly release (if known):

Operating environment (Docker/Windows/Linux/QNAP, etc.):

OS X

Description of problem: Telly does not see a config file next to it if it is launched from outside that directory.

Contents of telly.config.toml [if you're using a version above 1.1]:

[IPTV] Streams = 1 Starting-Channel = 10000 XMLTV-Channels = true

[Log] Level = "info" Requests = true

[Web] Base-Address = "192.168.1.61:6077" Listen-Address = "192.168.1.61:6077"

[SchedulesDirect] Username = "REDACTED" Password = "REDACTED"

[[Source]] Name = "Iris-files" Provider = "Custom" M3U = "/Users/cl186073/telly-testing/iris/iris-iptv.m3u" EPG = "/Users/cl186073/telly-testing/iris/iris.epg.xml" Filter = "UK DOCUMENTARIES|UK ENTERTAINMENT|UK MOVIE NETWORKS|UK NEWS NETWORKS|USA ENTERTAINMENT|USA MOVIE NETWORKS|USA NEWS NETWORKS|USA VIP HD" FilterKey = "group-title" FilterRaw = false Sort = "group-title"


**Command line used to run telly [if applicable]:**
- REMEMBER TO DELETE ANY CREDENTIALS IN CONFIG FILES OR COMMAND LINES

./SOME_DIRECTORY/telly


**Docker run command used to run telly [if applicable]:**
- REMEMBER TO DELETE ANY CREDENTIALS IN CONFIG FILES OR COMMAND LINES

**telly or docker log:**

➜ telly-testing find telly-1.1.0.2.darwin-amd64/ telly-1.1.0.2.darwin-amd64/ telly-1.1.0.2.darwin-amd64//LICENSE telly-1.1.0.2.darwin-amd64//NOTICE telly-1.1.0.2.darwin-amd64//telly telly-1.1.0.2.darwin-amd64//telly.config.toml ➜ telly-testing ./telly-1.1.0.2.darwin-amd64/telly INFO[2018-08-30T09:09:43-05:00] telly is preparing to go live (version=1.1.0.2, branch=dev, revision=f1de7f04430f9f6d35ad7caf55d4d5360a1d681c) INFO[2018-08-30T09:09:43-05:00] telly is live and on the air! INFO[2018-08-30T09:09:43-05:00] Broadcasting from http://localhost:6077/ INFO[2018-08-30T09:09:43-05:00] EPG URL: http://localhost:6077/epg.xml ^C

telly couldn’t find its config file, but cd into the directory:

➜ telly-testing cd telly-1.1.0.2.darwin-amd64 ➜ telly-1.1.0.2.darwin-amd64 ./telly INFO[2018-08-30T09:09:53-05:00] telly is preparing to go live (version=1.1.0.2, branch=dev, revision=f1de7f04430f9f6d35ad7caf55d4d5360a1d681c) INFO[2018-08-30T09:09:55-05:00] Loading M3U from /Users/cl186073/telly-testing/telly-1.1.0.1.darwin-amd64/iris-iptv.m3u INFO[2018-08-30T09:09:55-05:00] Loading XMLTV from /Users/cl186073/telly-testing/telly-1.1.0.1.darwin-amd64/iris.epg.xml INFO[2018-08-30T09:10:04-05:00] Requesting guide data for 0 programs from Schedules Direct INFO[2018-08-30T09:10:04-05:00] Making 0 requests to Schedules Direct for program information, this might take a while INFO[2018-08-30T09:10:04-05:00] Making 0 requests to Schedules Direct for artwork, this might take a while INFO[2018-08-30T09:10:04-05:00] Loaded 271 channels into the lineup from Heisenberg INFO[2018-08-30T09:10:05-05:00] telly is live and on the air! INFO[2018-08-30T09:10:05-05:00] Broadcasting from http://192.168.1.61:6077/ INFO[2018-08-30T09:10:05-05:00] EPG URL: http://192.168.1.61:6077/epg.xml ^C ➜ telly-1.1.0.2.darwin-amd64


and all is well.

**Additional information:**
guyspr commented 6 years ago

It's searching for the config file in the working directory where telly is ran from, so this is kinda expected behaviour. It could be changed to use the directory where the executable is located, could be an imporvement.

chazlarson commented 6 years ago

I agree that it's expected behavior once you realize that's what it's doing. I had just spent a bunch of time chatting with someone who had this problem. They had telly and its config in /opt/telly and then in their ssh session were running it from their home directory. It took a little while before it occurred to me that they might be doing that and that telly was actually looking in the CWD.

I'll update the readme to be more explicit, but I think telly looking next to itself for the config file is more intuitive than using the CWD.

robbiet480 commented 6 years ago

You can specify the path to the config file via the --config.file argument. By default, Telly looks in the working directory, /etc/telly/ and $HOME/.telly. It accepts JSON, TOML, YAML, HCL, and Java Properties files, it just needs to be named telly.config.<ext> for it to be recognized. Setting the log level to debug will show you the compiled configuration after startup, which contains values passed in the config file, in arguments and environment variables.