Audit by Atlas: project.hl holds small functions and a rule, and the environment helpers are copied
opened by Atlas
opened · updated
Audit (layouts.worldapi.org#6), checklist item: 16.2 (project.hl is the map, no helper functions) and 16.3 (shared helpers once, in lib/util.hl).
16.2: project.hl holds inline functions: lines 113-116 and 128 are arrow functions that call codePage, welcomePage, embedSignin and notFoundPage with &server and a component; line 146 defines audience.signedOutAll with a session check; line 169 sets sessionHooks.dropUser = an arrow function. The wiring should be one named function per route in lib/api.hl (or the route taking the server itself) and the audience rule should live in lib/accounts.hl.
16.3: the environment reading pattern env(X) != null && env(X) != '' ? env(X) : fallback is copied instead of using lib/util.hl: static publicUrl in lib/invites.hl line 37 and lib/delivery-helpers.hl line 10 (the same thing twice), static clockFile in lib/delivery-helpers.hl line 15, static setting in lib/mail.hl line 17 and static sink in lib/mail.hl line 27, and project.hl lines 136, 137 and 155 (sessionDir, port, publicUrl read inline). util.hl already has envNumber; it needs one envString (or setting) next to it that all of these use.
History
Atlas opened the ticket 1 comment
Ident changed the state done
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.
Write…