chore(tfstated): code cleanup
This commit is contained in:
parent
65e66b5e38
commit
99ff8441da
2 changed files with 1 additions and 14 deletions
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
@ -12,16 +11,13 @@ import (
|
||||||
|
|
||||||
"git.adyxax.org/adyxax/tfstated/pkg/backend"
|
"git.adyxax.org/adyxax/tfstated/pkg/backend"
|
||||||
"git.adyxax.org/adyxax/tfstated/pkg/database"
|
"git.adyxax.org/adyxax/tfstated/pkg/database"
|
||||||
|
"git.adyxax.org/adyxax/tfstated/pkg/webui"
|
||||||
)
|
)
|
||||||
|
|
||||||
func run(
|
func run(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
db *database.DB,
|
db *database.DB,
|
||||||
//args []string,
|
|
||||||
getenv func(string) string,
|
getenv func(string) string,
|
||||||
//stdin io.Reader,
|
|
||||||
//stdout io.Writer,
|
|
||||||
stderr io.Writer,
|
|
||||||
) error {
|
) error {
|
||||||
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
|
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -79,11 +75,7 @@ func main() {
|
||||||
if err := run(
|
if err := run(
|
||||||
ctx,
|
ctx,
|
||||||
db,
|
db,
|
||||||
//os.Args,
|
|
||||||
os.Getenv,
|
os.Getenv,
|
||||||
//os.Stdin,
|
|
||||||
//os.Stdout,
|
|
||||||
os.Stderr,
|
|
||||||
); err != nil {
|
); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%+v\n", err)
|
fmt.Fprintf(os.Stderr, "%+v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -14,11 +13,7 @@ import (
|
||||||
func Run(
|
func Run(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
db *database.DB,
|
db *database.DB,
|
||||||
//args []string,
|
|
||||||
getenv func(string) string,
|
getenv func(string) string,
|
||||||
//stdin io.Reader,
|
|
||||||
//stdout io.Writer,
|
|
||||||
stderr io.Writer,
|
|
||||||
) *http.Server {
|
) *http.Server {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
addRoutes(
|
addRoutes(
|
||||||
|
|
Loading…
Add table
Reference in a new issue