From d4fbaab5ca515dbfff4a60ca38dafea0e274bd7f Mon Sep 17 00:00:00 2001 From: eleksir Date: Sat, 8 Jan 2022 02:21:44 +0300 Subject: [PATCH] Update README, config example, cpanfile --- README | 8 ++++---- bin/aleesa-webapp | 3 ++- cpanfile | 6 +++++- data/config_sample.json | 12 ++++++------ lib/WebApp/Client.pm | 1 - 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README b/README index 1367de4..16abadb 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ aleesa-webapp Механика работы ----------------------------------------------------------------------------------------------------------------------- -Клиент подписан на на redis-канал craniac. В этот канал пишет другой демоночек - aleesa-misc. +Клиент подписан на на redis-канал webapp. В этот канал пишет другой демоночек - aleesa-misc. Формат протокола @@ -61,7 +61,7 @@ https://home.openweathermap.org/api_keys . Free plan предлагает всё приложение. В каталоге contrib находится скрипт для alpine linux, системы инициализации openrc. Этот скрипт достаточно положить В -/etc/init.d/aleesa-misc сконфигурить сервис по инструкции выше и после этого сервис запускается командой: -service aleesa-misc start +/etc/init.d/aleesa-webapp сконфигурить сервис по инструкции выше и после этого сервис запускается командой: +service aleesa-webapp start в автозагрузку его можно прописать через команду -rc-update add aleesa-misc default +rc-update add aleesa-webapp default diff --git a/bin/aleesa-webapp b/bin/aleesa-webapp index 52f270c..b24fe58 100755 --- a/bin/aleesa-webapp +++ b/bin/aleesa-webapp @@ -33,6 +33,7 @@ use Log::Any qw ($log); use Log::Any::Adapter; use Log::Any::For::Std; use POSIX qw (setgid setuid setsid); + use Conf qw (LoadConf); use WebApp qw (RunWebApp); @@ -43,7 +44,7 @@ sub __signal_handler; local $OUTPUT_AUTOFLUSH = 1; my $runAsUid = $UID; -my $piddir = '/var/run/' . basename (abs_path ($PROGRAM_NAME)); +my $piddir = '/var/run/' . basename (abs_path $PROGRAM_NAME); my $C = LoadConf (); my $loglevel = $C->{'loglevel'} // 'notice'; my $logfile; diff --git a/cpanfile b/cpanfile index d59b9b8..155bc83 100644 --- a/cpanfile +++ b/cpanfile @@ -1,10 +1,12 @@ -requires 'Carp', '0'; +requires 'Carp', '==1.50'; requires 'CHI', '==0.61'; requires 'CHI::Driver::BerkeleyDB', '==0.05'; +requires 'Cwd', '==3.75'; requires 'Cwd::utf8', '==0.011'; requires 'DateTime', '==1.55'; requires 'Digest::HMAC_SHA1', '==1.04'; requires 'Encode', '==3.16'; +requires 'English', '0'; requires 'EV', '==4.33'; requires 'File::Basename', '0'; requires 'File::Path', '==2.18'; @@ -17,9 +19,11 @@ requires 'Log::Any', '==1.710'; requires 'Log::Any::Adapter', '==1.710'; requires 'Log::Any::For::Std', '==0.05'; requires 'Math::Random::Secure', '==0.080001'; +requires 'MIME::Base64', '==3.16'; requires 'Mojolicious', '==9.22'; requires 'Mojo::IOLoop::Signal', '==0.003'; requires 'Mojo::Redis', '==3.27'; +requires 'Mojo::UserAgent', '0'; requires 'Mojo::UserAgent::Cached', '==1.18'; requires 'POSIX', '0'; requires 'Protocol::Redis::XS', '0'; diff --git a/data/config_sample.json b/data/config_sample.json index 60d13c5..2911d88 100644 --- a/data/config_sample.json +++ b/data/config_sample.json @@ -2,12 +2,12 @@ # server address "server" : "redis", "port" : "6379", - "channels": [ + "channels" : [ "webapp" ], # should we fork() and become unix daemon? - "daemonize": 1, + "daemonize" : 1, # where caches go there "cachedir" : "data/cache", @@ -17,7 +17,7 @@ # logs goes there "log" : "/var/log/aleesa-webapp/aleesa-webapp.log", - "loglevel": "notice", + "loglevel" : "notice", # ditto "pid" : "/var/run/aleesa-webapp/aleesa-webapp.pid", @@ -26,15 +26,15 @@ "forwards_max" : 5, "openweathermap" : { - "appid": "get_it_on_openweathermap.org" + "appid" : "get_it_on_openweathermap.org" }, - "image": { + "image" : { "dir" : "data/image", "flickr" : { "consumer_key" : "key", "consumer_secret" : "key_secret", - "verifier": "verifier_key" + "verifier" : "verifier_key" } } } diff --git a/lib/WebApp/Client.pm b/lib/WebApp/Client.pm index 516feaa..67fa521 100644 --- a/lib/WebApp/Client.pm +++ b/lib/WebApp/Client.pm @@ -16,7 +16,6 @@ use HTML::TokeParser; use JSON::XS; use Log::Any qw ($log); use Math::Random::Secure qw (irand); -use Mojo::Log; use Mojo::UserAgent; use Mojo::UserAgent::Cached; use Mojo::Util qw (trim);