Skip to content

Commit d02b6c0

Browse files
committed
make cli binary path configurable
Somehow on the server there's an issue with (a) the snap binary that can't load the config file and (b) the binary not being found in `~/bin/` with just `should-i-watch-this`. Configuring the absolute path to the binary works.
1 parent 115fb7a commit d02b6c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

www/app/models/movie.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Movie
22
KEY_PREFIX = "siwt_movie"
3+
CLI_BIN = ENV.fetch("CLI_BIN", "should-i-watch-this")
34

45
class Error < StandardError; end
56

@@ -26,7 +27,7 @@ def self.get_local(title, year)
2627
end
2728

2829
def self.search!(query)
29-
json = JSON.parse(`should-i-watch-this lookup -f json #{query} -l`)
30+
json = JSON.parse(`#{CLI_BIN} lookup -f json #{query} -l`)
3031

3132
if error = json["error"]
3233
Rails.logger.error("event=movie_search_error error=#{error.inspect}")
@@ -49,7 +50,7 @@ def self.load(title, year)
4950
end
5051

5152
def self.fetch(title, year)
52-
JSON.parse(`should-i-watch-this lookup -f json #{title} -y #{year} -l`)
53+
JSON.parse(`#{CLI_BIN} lookup -f json #{title} -y #{year} -l`)
5354
end
5455

5556
def self.key(title, year)

0 commit comments

Comments
 (0)