lua_pushstring(L, "current_storage");
lua_pushstring(L, uri);
lua_rawset(L, -3);
+ lua_pop(L, 1);
lua_pushboolean(L, 1);
return 1;
{
struct engine *engine = engine_luaget(L);
kr_cache_close(&engine->resolver.cache);
+ lua_getglobal(L, "cache");
+ lua_pushstring(L, "current_size");
+ lua_pushnumber(L, 0);
+ lua_rawset(L, -3);
+ lua_pop(L, 1);
lua_pushboolean(L, 1);
return 1;
}
lua_setglobal(engine->L, "verbose");
lua_pushcfunction(engine->L, l_option);
lua_setglobal(engine->L, "option");
+ lua_pushcfunction(engine->L, l_setuser);
+ lua_setglobal(engine->L, "user");
lua_pushcfunction(engine->L, l_libpath);
lua_setglobal(engine->L, "libpath");
lua_pushlightuserdata(engine->L, engine);
/* Load config file */
if(access("config", F_OK ) != -1 ) {
ret = l_dosandboxfile(engine->L, "config");
- } else {
+ }
+ if (ret == 0) {
/* Load defaults */
static const char config_bytecode[] = {
#include "daemon/lua/config.inc"
if not pcall(net.listen, '127.0.0.1') then
error('failed to bind to localhost#53')
end
+end
+-- Open cache if not set/disabled
+if not cache.current_size then
+ cache.size = 10 * MB
end
\ No newline at end of file