linka-app/linka

FR: Set linkding instance and token as an ENV VAR / Docker Secret

fl4shback opened this issue ยท 5 comments

Hello!
I have a Linka instance that's protected behind Authelia. So it's not publicly accessible.
For convenience, I would like to be able to persist my token and linkding instance in the app even when my browser local storage is reset.

Do you think it would be possible to set the token and instance URL as ENV vars ?

Thanks!

cmsax commented

It's possible to pass environment variables to react building stage, then the vars would be statically embedded to the HTML/JS files and visible to all front-end users. If this is ok, maybe we can try it.

Maybe it's better to set the secrets in a proxy which is invisible to users, e.g. Nginx server, like following:

location = /oneapi {
  set $args $args&apiKey=tiger;
  proxy_pass https://api.somewhere.com;
}

Both solutions need modification to Dockerfile.

cmsax commented

For more information about react envs, please read this page: https://vitejs.dev/guide/env-and-mode.html

For my use case both of the 2 solutions would work as my instance is private, but I agree that for other users the first one would be less than ideal from a security standpoint.

Wouldn't the proxy solution require more than just editing the Dockerfile ?
Sorry, I'm not versed at all in JS and React.

cmsax commented

๐Ÿ‘Œ I got it, maybe this weekend I'll implement this feature.

Hi!
Did you have time to look into this ?
Thanks ๐Ÿ˜Š