-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: basepath routing for DevServer vhost emulation #59
Changes from 3 commits
6ac028b
ff0fc09
36990fd
fdf49ca
7e83c6d
a51fa07
588fc78
d79cccb
a97653b
d2d8b79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ defmodule Tableau.Config do | |
|
||
defstruct [ | ||
:url, | ||
base_path: "", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add documentation for this. Its in the Tableau moduledoc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
include_dir: "extra", | ||
timezone: "Etc/UTC", | ||
reload_log: false, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ defmodule Tableau.Router do | |
|
||
require Logger | ||
|
||
basepath = Application.get_env(:tableau, :config)[:base_path] | ||
|
||
@not_found ~g''' | ||
<!DOCTYPE html><html lang="en"><head></head><body>Not Found</body></html> | ||
'''html | ||
|
@@ -14,7 +16,7 @@ defmodule Tableau.Router do | |
plug :rerender | ||
|
||
plug Tableau.IndexHtml | ||
plug Plug.Static, at: "/", from: "_site", cache_control_for_etags: "no-cache" | ||
plug Plug.Static, at: "/#{basepath}", from: "_site", cache_control_for_etags: "no-cache" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would also use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used |
||
|
||
plug :match | ||
plug :dispatch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
Path.join/2
here