aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/config
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-10-05 16:53:15 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-10-05 16:53:15 +0200
commit6e5062488fc3ecbf37c11e7d111bfe6ea3b5284d (patch)
tree6b568c854674295941cc1b827b3017879e66ebe5 /pkg/handler/config
parentada6a68b4f25c912705542a6b03aae7ffffb5e99 (diff)
downloadcerrado-6e5062488fc3ecbf37c11e7d111bfe6ea3b5284d.tar.gz
cerrado-6e5062488fc3ecbf37c11e7d111bfe6ea3b5284d.tar.bz2
cerrado-6e5062488fc3ecbf37c11e7d111bfe6ea3b5284d.zip
feat: Remove config page
That page was created as playground and had some debug purpose. Now that is not longer used and with introduction of sensible information (hash and aes-key) that has to go.
Diffstat (limited to 'pkg/handler/config')
-rw-r--r--pkg/handler/config/handler.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/pkg/handler/config/handler.go b/pkg/handler/config/handler.go
deleted file mode 100644
index c43b54d..0000000
--- a/pkg/handler/config/handler.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package config
-
-import (
- "bytes"
- "encoding/json"
- "net/http"
-
- "github.com/alecthomas/chroma/v2/formatters/html"
- "github.com/alecthomas/chroma/v2/lexers"
- "github.com/alecthomas/chroma/v2/styles"
-
- "git.gabrielgio.me/cerrado/pkg/config"
- "git.gabrielgio.me/cerrado/pkg/ext"
- "git.gabrielgio.me/cerrado/templates"
-)
-
-type (
- configurationRepository interface {
- GetRootReadme() string
- List() []*config.GitRepositoryConfiguration
- }
-)
-
-func ConfigFile(configRepo configurationRepository) ext.ErrorRequestHandler {
- return func(w http.ResponseWriter, _ *http.Request) error {
-
- config := struct {
- RootReadme string
- Repositories []*config.GitRepositoryConfiguration
- }{
- RootReadme: configRepo.GetRootReadme(),
- Repositories: configRepo.List(),
- }
-
- b, err := json.MarshalIndent(config, "", " ")
- if err != nil {
- return err
- }
-
- lexer := lexers.Get("json")
- style := styles.Get("monokailight")
- formatter := html.New(
- html.WithLineNumbers(true),
- )
- iterator, err := lexer.Tokenise(nil, string(b))
- if err != nil {
- return err
- }
-
- var code bytes.Buffer
- err = formatter.Format(&code, style, iterator)
- if err != nil {
- return err
- }
-
- hello := &templates.ConfigPage{
- Body: code.Bytes(),
- }
-
- templates.WritePageTemplate(w, hello)
- return nil
- }
-}