-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/tailsql: generate sample config as HuJSON
Generate the sample config from a template instead of using the raw JSON document, so that we can include explanatory comments.
- Loading branch information
1 parent
930ccbe
commit 4fc1afb
Showing
2 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Example tailsql configuration file. | ||
// This file is in HuJSON (JWCC) format; plain JSON also works. | ||
{ | ||
@{ with .Hostname }@// The tailnet hostname the server should run on. | ||
"hostname": "@{.}@",@{ end }@ | ||
@{ with .LocalState }@ | ||
// If set, a SQLite database URL to use for the query log. | ||
"localState": "@{.}@",@{ end }@ | ||
@{ with .LocalSource }@ | ||
// If localState is defined, export a read-only copy of the local state | ||
// database as a source with this name. | ||
"localSource": "@{.}@",@{ end }@ | ||
@{ if .Sources }@ | ||
// Databases that the server will allow queries against. | ||
"sources": [@{ range .Sources }@ | ||
{ | ||
// The name that selects this database in queries (src=name). | ||
"source": "@{ .Source }@", | ||
|
||
// A human-readable description for the database. | ||
"label": "@{ .Label }@", | ||
|
||
// The name of the database/sql driver to use for this source. | ||
"driver": "@{ .Driver }@", | ||
@{ if .Named }@ | ||
// Named queries supported by this database (q=named:x). | ||
"named": {@{ range $name, $query := .Named }@ | ||
"@{ $name }@": "@{ $query }@", | ||
@{ end }@},@{ end }@ | ||
|
||
// The database/sql connection string for the database. | ||
"url": "@{ .URL }@", | ||
}, | ||
@{ end }@],@{ end }@ | ||
@{ if .UILinks }@ | ||
// Additional links to display in the UI. | ||
"links": [@{ range .UILinks }@ | ||
{ | ||
"anchor": "@{ .Anchor }@", | ||
"url": "@{ .URL }@", | ||
},@{ end }@ | ||
],@{ end }@ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters