rails / mission_control-jobs

Dashboard and Active Job extensions to operate and troubleshoot background jobs
MIT License
611 stars 71 forks source link

I want to contribute and implement `http_auth` but need guidance on best practice/syntax #166

Open krtschmr opened 1 month ago

krtschmr commented 1 month ago

While we can inherit from our own BaseController to implement authentication, i wanted to provide an easy http_auth way.

i thought about the following syntax:

mount MissionControl::Jobs::Engine, at: "/jobs", http_auth: { user: "test", password: "123456" }

i would like to skip it if .test? or .development? so that means .production? or any other environment would have it active. additionally i would like to http_auth if ENV["MISSION_CONTROL_JOBS_USER"] && ENV["MISSION_CONTROL_JOBS_PASSWORD"] is set, regardless of environment.

So either you set it via ENV and it's active, or you can set it via http_auth option while mounting.

I'm just exploring if that syntax make sense and the PR would get merged? Otherwise i don't need to spend time on that ;-)

// edit: i realized that options provided are actually for mount and won't be forwarded to the engine. i'll just do ENV and config support