zk / inky

Sketch in ClojureScript
http://inky.cc
Eclipse Public License 1.0
3 stars 1 forks source link

Store edn meta locally during dev #4

Open mason-stewart opened 10 years ago

mason-stewart commented 10 years ago

I can locally compile gists at the /:login/:gist-id url, but the function for that route tries to (slurp (str "http://f.inky.cc/" gist-id "/meta.edn"). The hostname can easily be replaced with a HOST env var, but I can't see where such meta data is being stored locally. As is, to get around this I would have to have the gist compiled at inky.cc first, but that's pretty inconvenient.

zk commented 10 years ago

Great idea, unfortunately meta.edn isn't stored locally, it's constructed on-the-fly and uploaded to s3:

https://github.com/zk/inky/blob/master/src/clj/inky/compile.clj#L91

Off the top of my head, the storage engine would have to be abstracted to work with either s3 or local:

  1. Store generated files (code.js & meta.edn) in either s3, or the resources/public directory to be served by the web process.
  2. Update the 'has this been compiled check' (entry/in-s3?)
  3. Update the /:login/:gist-id/sketch handler to use one or the other

There's probably some thought that needs to be put into the simplest way to handle this (I don't really have the whole thing in my head right now), but a $HOST env var seems like a good way to handle 2 & 3. Not sure about 1. Perhaps a good name for that would be something like $SKETCH_BASE_URL?

In any case, it's worth asking whether or not this is worth the additional complexity. I think it is, as it would be nice not to be tied to s3.

Thoughts?