volatiletech / authboss

The boss of http auth.
MIT License
3.79k stars 204 forks source link

Ability to load template from embed.FS #329

Closed yusufmalikul closed 2 years ago

yusufmalikul commented 2 years ago

I have a Go app that embeds all HTML templates. Using authboss I need to provide login page template like this: ab.Config.Core.ViewRenderer = abrenderer.NewHTML("/auth", "/views")

Then I store the login template login.tpl inside /views/html-templates/login.tpl to override the built-in template. The login page shows the correct template if I run it inside the project directory. It didn't work if I run it outside the project directory because it read the system file and can't find the embedded login template using Go embed embed.FS.

Is it possible that ab.Config.Core.ViewRenderer supports template files from embed.FS?

Thank you.

yusufmalikul commented 2 years ago

I will close this because it is related to the authboss-renderer: https://github.com/volatiletech/authboss-renderer. I created a PR on that repo instead.