code wiki / _hdl_build / nx_site_provision.nx
nx_site_provision.nx source
↩ module page · 32 lines · 1977 B
1// nx_site_provision.nx -- THE one-call site provisioner: a .site config -> a provisioned s-class site
2// (compliant HTML + sites.conf line + manifest), or REFUSED if the config isn't s-class. This is "build
3// sites easily that are s-class" -- the config is portable data you own; s-class UX is enforced by construction.
4// argv[1]=name argv[2]=site_config argv[3]=out_html argv[4]=sites_conf argv[5]=manifest argv[6]=game_tpl.
5// license_tier: ORIGINAL
6import "nx_site_provision_lib.nx"
7
8func main(argc: i64, argv: *i64) -> i64 {
9 var name: *u8 = "site" as *u8
10 var sitep: *u8 = "web_assets/_sites/showcase.site" as *u8
11 var outhtml: *u8 = "web_assets/_provisioned/site.html" as *u8
12 var conf: *u8 = "knowledge/hosting/sites.provisioned.conf" as *u8
13 var manifest: *u8 = "knowledge/status/site_provision.manifest" as *u8
14 var gametpl: *u8 = "web_assets/game_template.html" as *u8
15 if argc >= 2 { name = argv[1] as *u8 }
16 if argc >= 3 { sitep = argv[2] as *u8 }
17 if argc >= 4 { outhtml = argv[3] as *u8 }
18 if argc >= 5 { conf = argv[4] as *u8 }
19 if argc >= 6 { manifest = argv[5] as *u8 }
20 if argc >= 7 { gametpl = argv[6] as *u8 }
21 sp_w(1, "=== NISHI SITE PROVISION: config -> s-class site in one call (s-class enforced by construction) ===\n" as *u8)
22 let r: i64 = sp_provision(name, sitep, outhtml, conf, manifest, gametpl)
23 if r == 0 {
24 sp_w(1, "PROVISIONED name=" as *u8); sp_w(1, name); sp_w(1, " html=" as *u8); sp_w(1, outhtml)
25 sp_w(1, " +sites.conf line +manifest admin=/cms/" as *u8); sp_w(1, name); sp_w(1, " verdict=GREEN (compliant)\n" as *u8)
26 sys_exit(0); return 0
27 }
28 if r == (0 - 2) { sp_w(1, "REFUSED: no/empty config (" as *u8); sp_w(1, sitep); sp_w(1, ")\n" as *u8); sys_exit(2); return 2 }
29 sp_w(1, "REFUSED: config is NOT s-class (compose refused, rc=" as *u8); sp_wn(1, r); sp_w(1, ") -- nothing provisioned, sites.conf untouched\n" as *u8)
30 sys_exit(1)
31 return 1
32}