aboutsummaryrefslogtreecommitdiff
path: root/internal/license.go
blob: bb4dc0b95acc6a3f64fba01a390e8caf990f0a93 (plain)
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
package internal

import (
	"fmt"
	"net/http"
	"os"

	"within.website/x/cmd/license/licenses"
	"go4.org/legal"
)

func init() {
	legal.RegisterLicense(licenses.CC0License)
	legal.RegisterLicense(licenses.SQLiteBlessing)

	http.HandleFunc("/.within/licenses", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "Licenses for this program: %s\n", os.Args[0])

		for _, li := range legal.Licenses() {
			fmt.Fprintln(w, li)
			fmt.Fprintln(w)
		}

		fmt.Fprintln(w, "Be well, Creator.")
	})
}