Is there a reason why Livebook secrets are automatically prepended with LB?

I spent probably 15 minutes trying to figure this out until I ran into What's new in Livebook 0.7 - Livebook.dev - The Livebook Blog and actually read through it because it’s somewhat buried at the end after a video.

You add a secret, API_SECRET_KEY, but to actually fetch it, you need to fetch LB_API_SECRET_KEY. Is there a reason for this?

2 Likes

—skip—

I see no reason other than well intended namespacing…with confusion as result.

2 Likes

I think one of the reasons is that a defined namespace allows Livebook to detect “environment variables” that Livebook is supposed to manage and give them special treatment.

Here’s a quick GIF video showing that difference:

https://media.cleanshot.cloud/media/43831/WaBMHyltLpa5qhcC7JEAGTUgS4BAO83zkRScC3ZY.gif?Expires=1679708197&Signature=nIZ4VR87LGR5Jwh28eMFrliKZrH4VFtDgL2RsLxXYM5HYzZ0ed9FjGJ8gQqtZas1y82uDm1k52O-TaLdiHB4OE7xUUeGP9FiLQWOt19QXRW8BEIdvPLm1NK3hecAzKOr0YxHQjeIE5znKd-uST-delo~RsSZh8FF5O5nfFZ-cWF--lqFBETfwfxwhhsua9JwMM4w04QbO2oUaWeSJ1bU2vYg1MDWVkEyofAW3-oM0h4EFE2sT1vClOY9iJfqmd2XGj5yBu1IAu0MtnY74n8UWXFYkvOR~CjSTy4DY5GFe0W965feeKyrY2HRejuD7sLIoqWLIo32murttmnjt6LEFQ__&Key-Pair-Id=K269JMAT9ZF4GZ

3 Likes

If that’s all there is to it, a simple helper text in the config modal would clarify.

This secret can be fetched with System.fetch_env!(“LB_SOME”)

@dmitriid maybe open issue marked as “usability issue”?

2 Likes

I didn’t think it warranted an issue, but I might just do that the next time I run into this :slight_smile:

1 Like

Added an issue: [Usability] Help text/popup/description that env variables are prefixed with LB_ · Issue #1827 · livebook-dev/livebook · GitHub

And while writing it discovered that there’s help text, but I never saw it :slight_smile:

image

1 Like

The issue got fixed immediately :slight_smile:

2 Likes