Skip to content

Commit

Permalink
Merge pull request #55 from tailscale-dev/erisa/control-server-url
Browse files Browse the repository at this point in the history
Add option for custom control server URLs
  • Loading branch information
Erisa committed Jul 16, 2024
2 parents f158acc + 57ebdb8 commit 836f902
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ environment variables. All of them are optional.
| `-use-funnel` | `USE_FUNNEL` | `false` | If set, expose individual pastes to the public internet with [Funnel](https://tailscale.com/kb/1223/funnel). |
| `-hide-funnel-users` | `HIDE_FUNNEL_USERS` | `false` | If set, don't display the username and profile picture of the user who created the paste in funneled pastes. |
| `-http-port` | `HTTP_PORT` | unset | If set, expose individual pastes on a HTTP server running on the given port. |
| `-control-url` | `TSNET_CONTROL_URL` | unset | If set, a custom control server to use, e.g. for Headscale users. |

## Deploying

Expand Down
8 changes: 5 additions & 3 deletions cmd/tclipd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (
useFunnel = flag.Bool("use-funnel", hasEnv("USE_FUNNEL"), "if set, expose individual pastes to the public internet with Funnel, USE_FUNNEL in the environment")
hidePasteUserInfo = flag.Bool("hide-funnel-users", hasEnv("HIDE_FUNNEL_USERS"), "if set, display the username and profile picture of the user who created the paste in funneled pastes")
httpPort = flag.String("http-port", envOr("HTTP_PORT", ""), "optional http port to start an http server on, e.g for reverse proxies. will only serve funnel endpoints")
controlUrl = flag.String("control-url", envOr("TSNET_CONTROL_URL", ""), "optional alternate control server URL to use, for e.g. headscale")

//go:embed schema.sql
sqlSchema string
Expand Down Expand Up @@ -672,9 +673,10 @@ func main() {
os.MkdirAll(filepath.Join(*dataDir, "tsnet"), 0700)

s := &tsnet.Server{
Hostname: *hostname,
Dir: filepath.Join(*dataDir, "tsnet"),
Logf: func(string, ...any) {},
Hostname: *hostname,
Dir: filepath.Join(*dataDir, "tsnet"),
Logf: func(string, ...any) {},
ControlURL: *controlUrl,
}

if *tsnetLogVerbose {
Expand Down

0 comments on commit 836f902

Please sign in to comment.