-
Notifications
You must be signed in to change notification settings - Fork 52
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
Set Tailscale hostname through environment variable. #18
Conversation
…e readme to reflect changes.
rather than add more magic env variables, I'd rather actually use caddy's configuration support. You can add configuration options for transports like anything else (see for example the http transport). Additionally, caddy has support for using environment variables in your config using
I thought we had an example of parsing a caddyfile in caddy-tailscale, but I guess not. There are caddy docs, as well as plenty of examples in caddy itself. If that's more than you're up for trying to do that's fine... I certainly don't mind adding support for this. It'd be good to get it in place anyway, since that would be the preferred method of configuring other parts of the module anyway. |
This is great, I would not have thought to do it this way. I'm curious to learn more Golang as well as Caddy modules, so... perfect :) I'll give this a shot. Thank you for the feedback. |
Any updates on this issue ? |
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout Signed-off-by: Will Norris <will@tailscale.com>
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout Signed-off-by: Will Norris <will@tailscale.com>
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout Signed-off-by: Will Norris <will@tailscale.com>
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout Signed-off-by: Will Norris <will@tailscale.com>
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout Signed-off-by: Will Norris <will@tailscale.com>
This includes: - Move TailscaleAuth logic into auth.go - Move all TSApp logic into app.go (including caddyfile parsing) - Rename "server" to "node" throughout. This aligns better with Tailscale terminology, and is reflective of the fact that nodes can also just be used as proxy transports, in which case they are not acting as servers at all. - Generally prefer referring to a node's "name" than "host". While this name is still used as the default hostname for the node, I would expect that to change with a future iteration of #18. - add godocs throughout Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
this overrides the name used to refer to the node in the caddy config, and is mostly useful because it can include environment variables. Closes #18 Co-authored-by: kdevan <kaidevan@gmail.com> Signed-off-by: Will Norris <will@tailscale.com>
This is a very simple PR that just allows changing the Tailscale hostname through an environment variable. You may want to pass on this if there's plans to allow for multiple hosts per TS node as described here.
My use case is using this with Fly.io which requires matching up the Fly app name with the Tailscale hostname. And since I do require multiple nodes, one for each secure Fly app, I need to be able to match those with multiple Tailscale hostnames. I also would like to be able to do multiple environments like stage and production.
For the logic to get the environment variable or use a fallback, I followed the way that it's done here with
TS_AUTHKEY
. The fallback is the hardcoded value that's here now. The environment variable nameTS_HOSTNAME
matches the one that the official Tailscale docker container uses. Then I just updatedREADME.md
to reflect this change.