orhun / rustypaste

A minimal file upload/pastebin service.
https://blog.orhun.dev/blazingly-fast-file-sharing
MIT License
760 stars 47 forks source link

Loading Auth Tokens from a file #338

Closed nydragon closed 3 weeks ago

nydragon commented 3 weeks ago

I am using agenix to encrypt my secrets. Agenix only exposes the path to the decrypted file, and not the content itself, necessitating to give an application the path to the file at runtime.

Since rustypaste either loads the auth token from the AUTH_TOKEN env var or the configuration file, I find myself unable to pass multiple auth tokens to the server.

I'd be interested in adding the parsing of an authentication file at server start, this authentication file could be provided via an AUTH_FILE env var, which holds the path, and the file itself could have a newline separated list of authentication tokens.

If there is a different or better method of implementing this feature I'd gladly hear about it.

orhun commented 3 weeks ago

Hello! 👋🏼

Have you tried placing your token in an .env file? (example here)

nydragon commented 3 weeks ago

Thanks for the reply!

Yes I did but that doesn't work with multiple token from my understanding, or is it possible to declare AUTH_TOKEN multiple times inside the .env?

nydragon commented 3 weeks ago

I have added the parsing of an auth/del token file to my fork and would then submit them as a PR if that is alright with you?

orhun commented 3 weeks ago

Yes I did but that doesn't work with multiple token from my understanding, or is it possible to declare AUTH_TOKEN multiple times inside the .env?

Ah I see. I don't think it support multiple tokens as of this moment.

I have added the parsing of an auth/del token file to my fork and would then submit them as a PR if that is alright with you?

Yes, please go ahead!

nydragon commented 3 weeks ago

Just opened a PR, also updated the README to reflect this new feature!