-- Default configuration
-cache.open('.', 10485760)
+cache.open(10*MB)
+-- Listen on localhost
+if not next(net.list()) then
+ if not pcall(net.listen, '127.0.0.1') then
+ error('failed to bind to localhost#53')
+ end
+end
\ No newline at end of file
+-- Units
+kB = 1024
+MB = 1024*1024
+GB = 1024*1024
+
+-- Function aliases
+-- `env.VAR returns os.getenv(VAR)`
+env = {}
+setmetatable(env, {
+ __index = function (t, k) return os.getenv(k) end
+})
+
+-- Quick access to interfaces
+-- `net.<iface>` => `net.interfaces()[iface]`
+setmetatable(net, {
+ __index = function (t, k)
+ local v = rawget(t, k)
+ if v then return v
+ else return net.interfaces()[k]
+ end
+ end
+})
+
-- Syntactic sugar for module loading
-- `modules.<name> = <config>`
setmetatable(modules, {