gluon-site: add default domain and check for it

This does not do anything yet, as this_domain() is not implemented yet.

Based-on-patch-by: lemoer <git@irrelefant.net>
This commit is contained in:
Matthias Schiffer 2018-01-19 07:15:38 +01:00
parent 07dbfea617
commit 24a085a542
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,20 @@
need_string(in_site({'site_code'})) need_string(in_site({'site_code'}))
need_string(in_site({'site_name'})) need_string(in_site({'site_name'}))
-- this_domain() returns nil when multidomain support is disabled
if this_domain() then
function need_domain_name(path)
need_string(path)
need(path, function(default_domain)
local f = io.open(os.getenv('IPKG_INSTROOT') .. '/lib/gluon/domains/' .. default_domain .. '.json')
if not f then return false end
f:close()
return true
end, nil, 'be a valid domain name')
end
need_domain_name(in_site({'default_domain'}))
end
need_string_match(in_domain({'domain_seed'}), '^' .. ('%x'):rep(64) .. '$') need_string_match(in_domain({'domain_seed'}), '^' .. ('%x'):rep(64) .. '$')
need_string({'opkg', 'lede'}, false) need_string({'opkg', 'lede'}, false)

View File

@ -18,6 +18,10 @@ function in_domain(var)
return var return var
end end
function this_domain()
return nil
end
local function path_to_string(path) local function path_to_string(path)
return table.concat(path, '/') return table.concat(path, '/')