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 option for custom control server URLs #55

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading