Skip to content

Commit 8d554c4

Browse files
committed
docs: convert more content to new guide, add link to guide
1 parent 9678faa commit 8d554c4

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

guide/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* [Startup event](advanced/startup_event.md)
2020
* [Application initializer](advanced/initializer.md)
2121
* [Library crate](advanced/library.md)
22+
* [Base URLs, public URLs, paths & reverse proxies](advanced/paths.md)
2223
---
2324

2425
[Contributing](contributing.md)

guide/src/advanced/paths.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Base URLs, public URLs, paths & reverse proxies
2+
3+
Since: `0.19.0-alpha.3`.
4+
5+
Originally `trunk` had a single `--public-url`, which allowed to set the base URL of the hosted application.
6+
Plain and simple. This was a prefix for all URLs generated and acted as a base for `trunk serve`.
7+
8+
Unfortunately, life isn't that simple and naming is hard.
9+
10+
Today `trunk` was three paths:
11+
12+
* The "public base URL": acting as a prefix for all generated URLs
13+
* The "serve base": acting as a scope/prefix for all things served by `trunk serve`
14+
* The "websocket base": acting as a base path for the auto-reload websocket
15+
16+
All three can be configured, but there are reasonable defaults in place. By default, the serve base and websocket base
17+
default to the absolute path of the public base. The public base will have a slash appended if it doesn't have one. The
18+
public base can be one of:
19+
20+
* Unset/nothing/default (meaning `/`)
21+
* An absolute URL (e.g. `http://domain/path/app`)
22+
* An absolute path (e.g. `/path/app`)
23+
* A relative path (e.g. `foo` or `./`)
24+
25+
If the public base is an absolute URL, then the path of that URL will be used as serve and websocket base. If the public
26+
base is a relative path, then it will be turned into an absolute one. Both approaches might result in a dysfunctional
27+
application, based on your environment. There will be a warning on the console. However, by providing an explicit
28+
value using serve-base or ws-base, this can be fixed.
29+
30+
Why is this necessary and when is it useful? It's mostly there to provide all the knobs/configurations for the case
31+
that weren't considered. The magic of public-url worked for many, but not for all. To support such cases, it
32+
is now possible to tweak all the settings, at the cost of more complexity. Having reasonable defaults should keep it
33+
simple for the simple cases.
34+
35+
An example use case is a reverse proxy *in front* of `trunk serve`, which can't be configured to serve the trunk
36+
websocket at the location `trunk serve` expects it. Now, it is possible to have `--public-url` to choose the base when
37+
generating links, so that it looks correct when being served by the proxy. But also use `--serve-base /` to keep
38+
serving resource from the root.

guide/src/configuration/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ the **root** level of the `Trunk.toml` file.
5656
The version format is a "version requirement", the same format you might know from Cargo's version field on
5757
dependencies.
5858

59-
This also supports pre-release requirements, which allows to adopt upcoming features early.
59+
This also supports pre-release requirements, which allows adopting upcoming features early.
6060

6161
```admonish note
6262
Versions prior do `0.19.0-alpha.2` currently do not support this check, and so they will silently ignore

guide/src/getting-started/installation.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,16 @@ Using Nix, `trunk` can be installed using:
104104
```shell
105105
nix-env -i trunk
106106
```
107+
108+
## Update check
109+
110+
Since: `0.19.0-alpha.2`.
111+
112+
Trunk has an update check built in. By default, it will check the `trunk` crate on `crates.io` for a newer
113+
(non-pre-release) version. If one is found, the information will be shown in the command line.
114+
115+
This check can be disabled entirely, by not enabling the cargo feature `update_check`. It can also be disabled during
116+
runtime using the environment variable `TRUNK_SKIP_VERSION_CHECK`, or using the command line switch
117+
`--skip-version-check`.
118+
119+
The actual check with `crates.io` is only performed every 24 hours.

site/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ favicon = "rustacean-flat-happy.svg"
1717
juice_logo_name = "Trunk"
1818
juice_logo_path = "rustacean-flat-happy.svg"
1919
juice_extra_menu = [
20+
{ title = "Guide", link = "https://trunkrs.dev/guide"},
2021
{ title = "GitHub", link = "https://github.com/trunk-rs/trunk"}
2122
]

0 commit comments

Comments
 (0)