300-simple-tc-site-defaults 494 B

1234567891011121314151617181920212223
  1. #!/usr/bin/lua
  2. local site = require 'gluon.site_config'
  3. local uci = require 'luci.model.uci'
  4. local c = uci.cursor()
  5. for name, config in pairs(site.simple_tc) do
  6. if not c:get('gluon-simple-tc', name) then
  7. c:section('gluon-simple-tc', 'interface', name,
  8. {
  9. ifname = config.ifname,
  10. enabled = config.enabled and 1 or 0,
  11. limit_egress = config.limit_egress,
  12. limit_ingress = config.limit_ingress,
  13. }
  14. )
  15. end
  16. end
  17. c:save('gluon-simple-tc')
  18. c:commit('gluon-simple-tc')