Hello, I recently updated my script to load it’s config from a webpage so I don’t have to update it on all my different servers when I make changes. It seems to work fine except for when I refresh it. When I refresh it doesn’t get the latest result. It will say that it has worked even if I delete the config file from the webserver. It’s almost as if http.Fetch has a cache of some sort.
plt_config.lua (in autorun)
plt_conf_file = "http://porchlight.rpk.bz/config.lua" function plt_conf_overrides() plt_cooldowntime = 20 print("[Porchlight] Loaded override config successfully.") end
plt_main.lua (in autorun)
function plt_conf_initf(reloaded) print("[Porchlight] Starting loading config file \"" .. plt_conf_file .. "\".") http.Fetch( plt_conf_file, function( body, len, headers, code ) print("[Porchlight] HTTP CODE : " .. code) if code == 200 then RunString( body, "plt_conf_loader", true ) plt_conf_overrides() if reloaded then print("[Porchlight] Config file reloaded successfully.") end else print("[Porchlight] ERROR : Config loaded unsuccessfully.") end end, function( error ) print("[Porchlight] ERROR : Config loaded unsuccessfully.") end ) end hook.Add( "Initialize", "plt_conf_inith", plt_conf_initf(false) )
Running plt_conf_initf() again will return
[Porchlight] Starting loading config file "http://porchlight.rpk.bz/config.lua". [Porchlight] HTTP CODE : 200 [Porchlight] Loaded base config successfully. [Porchlight] Loaded override config successfully.
even if config.lua doesn’t exist on the webserver. Is it possible that it does this because the config file is so large? Is there a better way I should be doing this? Or if there is a cache, how can I clear it every time the function runs?