From 9605a9d6f607eb2a871cca2ac84889245272512a Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Tue, 30 Apr 2024 17:07:14 +0100 Subject: [PATCH] Formatting --- cmd/tclipd/main.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/tclipd/main.go b/cmd/tclipd/main.go index a20ff85..afe1975 100644 --- a/cmd/tclipd/main.go +++ b/cmd/tclipd/main.go @@ -23,11 +23,11 @@ import ( "github.com/go-enry/go-enry/v2" "github.com/google/uuid" + _ "github.com/lib/pq" "github.com/microcosm-cc/bluemonday" "github.com/niklasfasching/go-org/org" "github.com/russross/blackfriday" _ "modernc.org/sqlite" - _ "github.com/lib/pq" "tailscale.com/client/tailscale" "tailscale.com/client/tailscale/apitype" "tailscale.com/ipn" @@ -36,12 +36,12 @@ import ( ) var ( - hostname = flag.String("hostname", envOr("TSNET_HOSTNAME", "paste"), "hostname to use on your tailnet, TSNET_HOSTNAME in the environment") - dataDir = flag.String("data-location", dataLocation(), "where data is stored, defaults to DATA_DIR or ~/.config/tailscale/paste") - tsnetLogVerbose = flag.Bool("tsnet-verbose", hasEnv("TSNET_VERBOSE"), "if set, have tsnet log verbosely to standard error") - 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") - databaseUrl = flag.String("database-url", envOr("DATABASE_URL", ""), "optional database url if you'd rather use Postgres instead of sqlite") + hostname = flag.String("hostname", envOr("TSNET_HOSTNAME", "paste"), "hostname to use on your tailnet, TSNET_HOSTNAME in the environment") + dataDir = flag.String("data-location", dataLocation(), "where data is stored, defaults to DATA_DIR or ~/.config/tailscale/paste") + tsnetLogVerbose = flag.Bool("tsnet-verbose", hasEnv("TSNET_VERBOSE"), "if set, have tsnet log verbosely to standard error") + 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") + databaseUrl = flag.String("database-url", envOr("DATABASE_URL", ""), "optional database url if you'd rather use Postgres instead of sqlite") //go:embed schema.sql sqlSchema string @@ -826,12 +826,12 @@ func (mch MixedCriticalityHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ func openDB(dir string, databaseUrl string) (*sql.DB, error) { dbtype := "sqlite" - dbpath := "file:"+filepath.Join(dir, "data.db") + dbpath := "file:" + filepath.Join(dir, "data.db") if databaseUrl != "" { dbtype = "postgres" dbpath = databaseUrl } - + db, err := sql.Open(dbtype, dbpath) if err != nil { return nil, err @@ -849,7 +849,7 @@ func openDB(dir string, databaseUrl string) (*sql.DB, error) { return nil, err } } - + if _, err := db.Exec(sqlSchema); err != nil { return nil, err }