summaryrefslogtreecommitdiff
path: root/weather-widget
diff options
context:
space:
mode:
authorPavel Makhov <pmakhov@touchtunes.com>2019-01-25 22:26:16 -0500
committerPavel Makhov <pmakhov@touchtunes.com>2019-01-25 22:26:16 -0500
commit15e6d0fcd96acd02250fc6a5bff6590c118cb8a1 (patch)
treea51b68f53b0dc24c006a6609047e22e654dc20f4 /weather-widget
parentcdd3d9450bd5efc9f1be0392e62131e2d6c38ac2 (diff)
store api keys and client settings in secrets.lua
Diffstat (limited to 'weather-widget')
-rw-r--r--weather-widget/weather.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua
index 88d3658..973a776 100644
--- a/weather-widget/weather.lua
+++ b/weather-widget/weather.lua
@@ -10,9 +10,10 @@ local http = require("socket.http")
local json = require("json")
local naughty = require("naughty")
local wibox = require("wibox")
+local gears = require("gears")
+
+local secrets = require("awesome-wm-widgets.secrets")
-local city = os.getenv("AWW_WEATHER_CITY") or "Montreal,ca"
-local open_map_key = os.getenv("AWW_WEATHER_API_KEY") or 'c3d7320b359da4e48c2d682a04076576'
local path_to_icons = "/usr/share/icons/Arc/status/symbolic/"
local icon_widget = wibox.widget {
@@ -93,11 +94,11 @@ function to_direction(degrees)
return directions[math.floor((degrees % 360) / 22.5) + 1]
end
-local weather_timer = timer({ timeout = 60 })
+local weather_timer = gears.timer({ timeout = 60 })
local resp
weather_timer:connect_signal("timeout", function ()
- local resp_json = http.request("https://api.openweathermap.org/data/2.5/weather?q=" .. city .."&appid=" .. open_map_key)
+ local resp_json = http.request("https://api.openweathermap.org/data/2.5/weather?q=" .. secrets.weather_widget_city .."&appid=" .. secrets.weather_widget_api_key)
if (resp_json ~= nil) then
resp = json.decode(resp_json)
icon_widget.image = path_to_icons .. icon_map[resp.weather[1].icon]