forked from todaywasawesome/color-coded
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.go
38 lines (28 loc) · 850 Bytes
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"os"
"fmt"
"net/http"
"github.com/golangci/golangci-lint/pkg/exitcodes"
)
func main() {
//Add a GPL3 package to cause havock
os.Setenv("test", string(exitcodes.Success))
c := os.Getenv("COLOR")
if len(c) == 0{
os.Setenv("COLOR", "#F1A94E") //Blue 44B3C2 and Yellow F1A94E
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "<html onclick=\"window.location.href = '/die'\" style='background:" + os.Getenv("COLOR") + "'> Requested: %s\n </html>", r.URL.Path)
})
http.HandleFunc("/dashboard", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "<html> DASHBOARD Requested: %s\n </html>", r.URL.Path)
})
http.HandleFunc("/die", func(w http.ResponseWriter, r *http.Request) {
die();
})
http.ListenAndServe(":8080", nil)
}
func die() {
os.Exit(3)
}