here is how you could set this up. i tried it and lua accepts it.
create a shell script outside your space and name it secret.key with following content:
#!/bin/bash
echo $OWM_API_KEY
now give this script executable permissions: chmod +x secret.key
add your key to the Environmental variables
OWM_API_KEY="YOURSUPERSECRETOWMAPIKEY"
then you can call the shell script directly in your config like this:
config.set( "owm", {
apiKey = shell.run("../secret.key").stdout
refresh = 30,
defLocation = "Nanchang",
...
})
Notice the relative path of the secret.key shell command to your space, ../ means right outside your space folder.
you restart your silverbullet instance/service to validate the Environmental variable.
and here you go, you keep your key outside your space.
i just tried it and it works surprisingly well, and like this, you don’t store your API_KEY in plain text in your space.
![]()
CAUTION
![]()
this works only in a truly read only scenario:
because if silverbullet has write permissions, then someone could use this space-lua:
editor.flashNotification(shell.run("../secret.key").stdout)
and the API_KEY appears as a flash notification.