huacnlee / rucaptcha

Captcha Gem for Rails, which generates captcha image by Rust.
https://huacnlee.github.io/rucaptcha
MIT License
693 stars 133 forks source link

Allow custom mount path #106

Closed Gao-Jun closed 11 months ago

Gao-Jun commented 11 months ago

This PR add the ability to custom RuCaptcha's mount path with RuCaptcha.config.mount_path.

In my project, I make a sub project of a domain and mount the project at /foo, and I cannot deploy RuCaptcha to /rucaptcha.

With this PR, I can mount it at /foo/rucaptcha. And I think maybe some other projects would use this feature.

在我的一个项目中,所有的应用都被要求都部署在 /foo 下,所以我希望将 RuCaptcha 部署在 /foo/rucaptcha。目前的配置文件无法支持这个操作,所以只能通过改 HTTP Server 配置的方式处理,或者 monkey patch (还需要在engine挂载前执行),都比较复杂。所以,这个 PR 希望通过增加新的配置项 mount_path 来更加优雅地实现这个需求。

Gao-Jun commented 11 months ago

PR updated.