Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --endpoint option for beacon.gen.site #761

Merged
merged 6 commits into from
Feb 20, 2025
Merged

Conversation

APB9785
Copy link
Contributor

@APB9785 APB9785 commented Feb 13, 2025

Resolves #759

@APB9785 APB9785 self-assigned this Feb 13, 2025
@@ -101,6 +104,7 @@ if Code.ensure_loaded?(Igniter) do

port = Keyword.get_lazy(options, :port, fn -> Enum.random(4101..4999) end)
secure_port = Keyword.get_lazy(options, :secure_port, fn -> Enum.random(8444..8999) end)
site_endpoint = Keyword.get_lazy(options, :endpoint, fn -> site_endpoint_module!(igniter, site) end)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Values given from args are in binary so you need to convert to a proper module:

Suggested change
site_endpoint = Keyword.get_lazy(options, :endpoint, fn -> site_endpoint_module!(igniter, site) end)
site_endpoint = Keyword.get_lazy(options, :endpoint, fn -> site_endpoint_module!(igniter, site) end)
site_endpoint = Module.concat([site_endpoint])

@@ -33,6 +33,8 @@ defmodule Mix.Tasks.Beacon.Gen.Site.Docs do
* `--host` (optional) - If provided, site will be served on that host.
* `--port` (optional) - The port to use for http requests. Only needed when `--host` is provided. If no port is given, one will be chosen at random.
* `--secure-port` (optional) - The port to use for https requests. Only needed when `--host` is provided. If no port is given, one will be chosen at random.
* `--endpoint` (optional) - The name of the Endpoint Module for your site. If not provided, a default will be generated based on the `site`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the name, Igniter will try to create files in a path that users may not expect. For eg:

--endpoint DockYardWeb.Endpoint

Creates the file lib/dock_yard_web/endpoint.ex

Which is expected because it follows the Phoenix convention. Are we just follow that pattern or find a way to overwrite the path name as well?

@leandrocp leandrocp merged commit c75250e into main Feb 20, 2025
3 checks passed
@leandrocp leandrocp deleted the apb/site-endpoint branch February 20, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

beacon.gen.site option for customizing Endpoint module
2 participants