You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently searching for an option to disable or hide the swagger endpoint in production code, right now I'm using a dummy router like PhoenixSwagger.Plug.SwaggerUI to just forward based on the env flag. Is this the correct approach or am I missing something?
Note: If that's the correct approach, I can create a PR to implement it by default in the library.
Thanks!
The text was updated successfully, but these errors were encountered:
We are doing the same in our projects, so I would vote for adding this feature 👍 .
@mangalakader are you able to enable/disable the swagger UI route with an env variable at runtime instead of at compile time? If so, how are you doing it?
@rarguelloF I would suggest to make a module plug that checks an environment variable and halts the Conn with a 404 response if the variable is false. You can then put this plug in the pipeline that runs before forwarding to the swagger-ui plug.
Such a module would be generally useful even outside of phoenix_swagger, so maybe it could be a separate package?
@mbuhot I personally think it would very useful to add a flag (enabled: true/false) with that functionality into PhoenixSwagger.Plug.SwaggerUI since I think it's a pretty common pattern (e.g. you want to enable swagger docs in staging but not in production), however it's your call.
In case you agree with adding this functionality, I would be open to open a PR, so please let me know what you think.
Hi @mbuhot ,
I'm currently searching for an option to disable or hide the swagger endpoint in production code, right now I'm using a dummy router like PhoenixSwagger.Plug.SwaggerUI to just forward based on the env flag. Is this the correct approach or am I missing something?
Note: If that's the correct approach, I can create a PR to implement it by default in the library.
Thanks!
The text was updated successfully, but these errors were encountered: