event_route[htable:mod-init] {
# generate auth token into
http_client_query("https://www.cryy.com/api/auth/token", '{"email": "brandon@cryy.com", "password":"XXXX"}', "$var(result)");
sht_lock("server=>auth::token");
$sht(server=>auth::token) = $var(result);
sht_unlock("server=>auth::token");
xinfo("AUTH_TOKEN_RECEIVED, $sht(server=>auth::token)");
}
event_route[htable:expired:server] {
# process expired htable, renew auth token
xinfo("AUTH_TOKEN_EXPIRED, lets retrieve a new one");
http_client_query("https://www.cryy.com/api/auth/token", '{"email": "brandon@cryy.com", "password":"XXXX"}', "$var(result)");
sht_lock("server=>auth::token");
$sht(server=>auth::time) = $TS;
$sht(server=>auth::token) = $var(result);
sht_unlock("server=>auth::token");
xinfo("AUTH_TOKEN_RECEIVED, $sht(server=>auth::token)");
xinfo("AUTH_TOKEN_TIME, $sht(server=>auth::time)");
}