Skip to content

Commit

Permalink
Move server into separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
Toby Padilla committed Oct 4, 2021
1 parent 61d135d commit a964f74
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 481 deletions.
182 changes: 0 additions & 182 deletions .github/workflows/cd.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/ci.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/soft-serve.yml

This file was deleted.

10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
soft-serve
.ssh
.repos
dist
.terraform*
*.tfstate*
*auto.tfvars
cmd/soft/soft
cmd/soft/.ssh
cmd/soft/.repos
23 changes: 0 additions & 23 deletions Dockerfile

This file was deleted.

37 changes: 37 additions & 0 deletions cmd/soft/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main

import (
"log"

"github.com/charmbracelet/soft"

"github.com/meowgorithm/babyenv"
)

type serverConfig struct {
Host string `env:"SOFT_SERVE_HOST" default:""`
Port int `env:"SOFT_SERVE_PORT" default:"23231"`
KeyPath string `env:"SOFT_SERVE_KEY_PATH" default:".ssh/soft_serve_server_ed25519"`
RepoPath string `env:"SOFT_SERVE_REPO_PATH" default:".repos"`
AuthKey string `env:"SOFT_SERVE_AUTH_KEY" default:""`
}

func main() {
var cfg serverConfig
err := babyenv.Parse(&cfg)
if err != nil {
log.Fatalln(err)
}
s := soft.NewServer(
cfg.Host,
cfg.Port,
cfg.KeyPath,
cfg.RepoPath,
cfg.AuthKey,
)
log.Printf("Starting SSH server on %s:%d\n", cfg.Host, cfg.Port)
err = s.ListenAndServe()
if err != nil {
log.Fatalln(err)
}
}
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"os"
"path/filepath"
"soft-serve/git"

"github.com/charmbracelet/soft/git"
gg "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/object"
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module soft-serve
module github.com/charmbracelet/soft

go 1.17

Expand Down
59 changes: 0 additions & 59 deletions main.go

This file was deleted.

Loading

0 comments on commit a964f74

Please sign in to comment.