Repository navigation
Add local dev carto API workflow and docs - #172
wagnerlmichael wants to merge 2 commits into
Conversation
| so that the [development server](#running-a-development-server) can render | ||
| them. Without it, the script builds static HTML into `hugo/public/` and then | ||
| deletes the Markdown, so the reports won't be available from `hugo serve`. | ||
|
|
There was a problem hiding this comment.
Added an explanation here about how when testing locally the hugo serve just needs the markdown, not the html flow through actions
| {{/* Carto basemap API key. Deployed builds use a key restricted to the | ||
| prod and staging hosts; `hugo serve` reads a local key from the | ||
| HUGO_CARTO_KEY env var (see README) */}} | ||
| const cartoKey = {{ cond hugo.IsServer (getenv "HUGO_CARTO_KEY") "cb1_45dr_1_d676f2f54005676a45bee03c" }}; |
There was a problem hiding this comment.
jeancochrane
left a comment
There was a problem hiding this comment.
Thanks for tying up this loose end!
| export HUGO_CARTO_KEY=<your_key> | ||
| ``` | ||
|
|
||
| 4. Run `hugo serve` and open a report that has a map. The tiles should load |
There was a problem hiding this comment.
[Thought, non-blocking] I think users will probably need to generate a report before they can run hugo serve and see maps, right? Not sure if that should be documented here, but I temporarily forgot about that step while testing.
| 3. Add the key to your shell profile (e.g. `~/.bashrc`), then restart your | ||
| shell: | ||
|
|
||
| ``` | ||
| export HUGO_CARTO_KEY=<your_key> | ||
| ``` |
There was a problem hiding this comment.
[Thought, non-blocking] I think this is a fine approach, but I keep my dotfiles under version control in a public repo, so I didn't want to stash this API key in my bashrc. Another alternative is just to store it in a password manager and then set the env var like so whenever you need to generate reports:
HUGO_CARTO_KEY=<my_key> python3 scripts/generate_homeval/generate_homeval.py ...
I don't necessarily think we need to document this flow, just flagging it in case it's interesting!
There was a problem hiding this comment.
Maybe the env method should be left for the user to approach on their own? Or do you think we should have some sort of instruction for it here? I'm not sure
There was a problem hiding this comment.
I think your instructions are fine!
Co-authored-by: Jean Cochrane <jeancochrane@users.noreply.github.com>
Takes care of #171.
I signed up for my own API key and it worked for me locally.