Best Practices for Retrieving Credentials in RMarkdown on Posit Connect

TL;DR: How do I store and get a secret in a published R Markdown document?

I am trying to schedule an R Markdown document so that it pushes data to a pin everyday. However, to publish the document, when I call pins::board_connect(auth = 'rsconnect'), I get a message on deploy that says that no boards are registered. So, I switched to pins::board_connect(auth = 'manual', server = MY_SERVER, key = MY_API_KEY. However, it seems like a bad idea to publish a document with my API key in it, even if the access permissions in Connect are set so that only I can see it. There must be some way that I can store a secret and access it? Any help would be much appreciated.

You should use auth = "envvar" when running on Connect, c.f.
Pins for R - Posit Connect: User Guide and Use Posit Connect as board — board_connect • pins for the full details.