From 8138733bd11e563b4fc85143d9a65264656e9d15 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Sat, 30 Jul 2022 13:39:48 +0000 Subject: [PATCH] move request code --- {request => cmd/request}/main.go | 5 +++-- main.go | 7 ------- request/gemini.go | 4 ++-- request/gitea.go | 4 ++-- request/request.go | 1 + 5 files changed, 8 insertions(+), 13 deletions(-) rename {request => cmd/request}/main.go (87%) delete mode 100644 main.go create mode 100644 request/request.go diff --git a/request/main.go b/cmd/request/main.go similarity index 87% rename from request/main.go rename to cmd/request/main.go index b5ad211..11406a3 100644 --- a/request/main.go +++ b/cmd/request/main.go @@ -6,6 +6,7 @@ import ( "os" "os/user" + "git.tilde.town/tildetown/town/request" townUser "git.tilde.town/tildetown/town/user" ) @@ -27,12 +28,12 @@ func _main(args []string) error { errs := []error{} - err = processGitea(requestPath) + err = request.ProcessGitea(requestPath) if err != nil { errs = append(errs, err) } - err = processGemini(requestPath) + err = request.ProcessGemini(requestPath) if err != nil { errs = append(errs, err) } diff --git a/main.go b/main.go deleted file mode 100644 index 2bf02be..0000000 --- a/main.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "git.tilde.town/tildetown/town/email" - -func main() { - email.SendLocalEmail("vilmibm", "testing hi", "this is a body") -} diff --git a/request/gemini.go b/request/gemini.go index 81b47f5..9fa876b 100644 --- a/request/gemini.go +++ b/request/gemini.go @@ -1,4 +1,4 @@ -package main +package request import ( "fmt" @@ -11,7 +11,7 @@ import ( const geminiHomeDocBase = "/home/gemini/users" -func processGemini(requestRootPath string) error { +func ProcessGemini(requestRootPath string) error { rp := filepath.Join(requestRootPath, "gemini") files, err := ioutil.ReadDir(rp) diff --git a/request/gitea.go b/request/gitea.go index 83ea105..42e3ec3 100644 --- a/request/gitea.go +++ b/request/gitea.go @@ -1,4 +1,4 @@ -package main +package request import ( "bytes" @@ -19,7 +19,7 @@ import ( const pwLetters = "!@#$%^&*() []{}:;,.<>/?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890" -func processGitea(rp string) error { +func ProcessGitea(rp string) error { apiToken := os.Getenv("GITEA_TOKEN") if apiToken == "" { return errors.New("need GITEA_TOKEN") diff --git a/request/request.go b/request/request.go new file mode 100644 index 0000000..725b8fc --- /dev/null +++ b/request/request.go @@ -0,0 +1 @@ +package request