sulu: 0.2.21

This commit is contained in:
vdutta 2021-12-07 19:49:30 +05:30
parent a5c8b7145f
commit c566d23c78
4 changed files with 2 additions and 57 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu
PKG_VERSION:=0.2.20
PKG_VERSION:=0.2.21
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/sulu.git

View file

@ -9,45 +9,9 @@ log() {
echo "${@}"|logger -t sulu.init -p debug
}
publish_endpoint() {
local AgentEndpointID serial oui user pass
local opt=""
# return if mosquitto_pub is not present
if ! which mosquitto_pub; then
log "mosquitto_pub not present can't publish endpointid"
return 0;
fi
ubus -t 10 wait_for usp.raw
# Get endpoint id from obuspa config first
config_load obuspa
config_get AgentEndpointID localagent EndpointID ""
if [ -z "${AgentEndpointID}" ]; then
serial=$(ubus -t 1 call usp.raw get '{"path":"Device.DeviceInfo.SerialNumber"}'|jsonfilter -e '@["parameters"][0].value')
oui=$(ubus -t 1 call usp.raw get '{"path":"Device.DeviceInfo.ManufacturerOUI"}'|jsonfilter -e '@["parameters"][0].value')
AgentEndpointID="os::${oui}-${serial}"
fi
config_get user localmqtt Username
if [ -n "${user}" ]; then
opt="-u ${user}"
fi
config_get pass localmqtt Password
if [ -n "${pass}" ]; then
opt="${opt} -P ${pass}"
fi
# publish Agent's EndpointID in mosquito broker for discovery
# This is a work around till obuspa does not support advertising
log "Publishing EndpointID ${AgentEndpointID} to local mqtt broker"
mosquitto_pub -r -t "obuspa/EndpointID" -m "${AgentEndpointID}" ${opt}
}
start_service() {
procd_open_instance sulu
publish_endpoint
# append sulu connection injection
procd_close_instance
}

View file

@ -1,18 +0,0 @@
# proxy required for nginx to save the file
location /upload_proxy {
return 200 "File upload is successful \n";
}
location /upload {
limit_except POST { deny all; }
client_body_temp_path /tmp/sulu; # the directory to which uploads will be saved, make sure to create the directory you wish to use
client_body_in_file_only on;
client_body_buffer_size 128K;
client_max_body_size 50M;
proxy_pass_request_headers on;
proxy_set_header X-FILE $request_body_file;
proxy_set_body $request_body_file;
proxy_redirect off;
#proxy_pass is necessary. body is only stored when being passed to middleware, so we are providing a proxy that just returns 200.
proxy_pass http://127.0.0.1:8080/upload_proxy;
}

View file

@ -5,6 +5,5 @@ uci -q get nginx._sulu && exit 0
uci -q set nginx._sulu=server
uci -q add_list nginx._sulu.listen='8080'
uci -q add_list nginx._sulu.listen='[::]:8080'
uci -q add_list nginx._sulu.include='conf.d/sulu.locations'
uci -q set nginx._sulu.root='/sulu'
uci -q set nginx._sulu.server_name='_sulu'