Skip to content
Snippets Groups Projects
Commit d3361568 authored by Karsten Böddeker's avatar Karsten Böddeker
Browse files

ffho-site-auto-select: remove community specific stuff

move geo_default_site to site.conf and add some documentation
parent 3ffb82c1
No related branches found
No related tags found
No related merge requests found
ffho-site-auto-select
=====================
Autoselect correct site-code by geocoordinates during upgrade and by ``gluon-neighbour-info`` hourly.
One can specify a default site within site.conf, if the coordinates do not match to any site defined within extra/geo.json.
site.conf
---------
site_select.geo_default_site : optional
- ``'ffho_uml'``
extra/geo.json
--------------
File with geojson format. The corresponding site_code has to be defined within ``properties`` section as ``"site_code": "ffho_abn"``.
......@@ -4,8 +4,7 @@ local uci = require('luci.model.uci').cursor()
local json = require 'luci.json'
local tools = require 'gluon.site_generate'
local shape = require 'gluon.pointwithinshape'
local geo_default_site = "ffho_yho"
local site_conf = require 'gluon.site_conf'
function get_config(file)
local f = io.open(file)
......@@ -47,7 +46,11 @@ function get_site_by_geo(latitude, longitude)
end
end
return geo_default_site
if (site_conf.site_select or {}).geo_default_site then
return site_conf.site_select.geo_default_site
end
return nil
end
local currentsite = uci:get('currentsite', 'current', 'name')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment