nprapps / liveblog-standalone

NPR's liveblog rig 2.0
Other
6 stars 1 forks source link

Get all config data from the document #1

Open thomaswilburn opened 4 years ago

thomaswilburn commented 4 years ago

Although much in-document configuration has been moved to the document, we still need to set up the publish endpoint and doc ID in local configuration files. BUT WHAT IF WE DIDN'T? It's possible to make the docs task a prerequisite to publishing, to make sure we always have a fresh config, and to store the publication slug in the doc itself. We could then run the same rig for any liveblog using a command line parameter: grunt deploy --doc=DOCUMENT_ID_HERE.

Placing it in the document directly is probably a recipe for disaster--we don't want people to be able to edit it by accident. But we could move it into the configuration for the document--however, another fun wrinkle is that document/script properties don't seem to be accessible outside of either the Scripts API (https://developers.google.com/apps-script/api/how-tos/execute) or inside Apps Script itself.

Another option is to place it in the document directly, but to encode it in some way that includes validation, such as a checksum or hash value for the URL. Editing either value would invalidate it, and abort the build until it could be fixed.