aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorQuentin <quentin@dufour.io>2023-04-19 13:11:46 +0000
committerQuentin <quentin@dufour.io>2023-04-19 13:11:46 +0000
commit1e75c21b65021da0c3c5a8be9be12114a2327464 (patch)
tree978a49da113a050c60bd8a803e0d641255f82ede /main.go
parent02670ba6a60af8db1818d6d3adaafc7810d14689 (diff)
parent83ed187dbc6d1ef5f08d74aa57a7d17e907581c9 (diff)
downloadguichet-1e75c21b65021da0c3c5a8be9be12114a2327464.tar.gz
guichet-1e75c21b65021da0c3c5a8be9be12114a2327464.zip
Merge pull request 'Manage Garage Websites from Guichet' (#19) from website into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/guichet/pulls/19
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/main.go b/main.go
index 31d5ac3..ae8fe06 100644
--- a/main.go
+++ b/main.go
@@ -48,6 +48,9 @@ type ConfigFile struct {
GroupCanInvite string `json:"group_can_invite"`
GroupCanAdmin string `json:"group_can_admin"`
+ S3AdminEndpoint string `json:"s3_admin_endpoint"`
+ S3AdminToken string `json:"s3_admin_token"`
+
S3Endpoint string `json:"s3_endpoint"`
S3AccessKey string `json:"s3_access_key"`
S3SecretKey string `json:"s3_secret_key"`
@@ -102,7 +105,12 @@ func readConfig() ConfigFile {
}
func getTemplate(name string) *template.Template {
- return template.Must(template.ParseFiles(templatePath+"/layout.html", templatePath+"/"+name))
+ return template.Must(template.New("layout.html").Funcs(template.FuncMap{
+ "contains": strings.Contains,
+ }).ParseFiles(
+ templatePath+"/layout.html",
+ templatePath+"/"+name,
+ ))
}
func main() {
@@ -129,6 +137,11 @@ func main() {
r.HandleFunc("/directory/search", handleDirectorySearch)
r.HandleFunc("/directory", handleDirectory)
+ r.HandleFunc("/garage/key", handleGarageKey)
+ r.HandleFunc("/garage/website", handleGarageWebsiteList)
+ r.HandleFunc("/garage/website/new", handleGarageWebsiteNew)
+ r.HandleFunc("/garage/website/b/{bucket}", handleGarageWebsiteInspect)
+
r.HandleFunc("/invite/new_account", handleInviteNewAccount)
r.HandleFunc("/invite/send_code", handleInviteSendCode)
r.HandleFunc("/invitation/{code}", handleInvitationCode)
@@ -247,6 +260,7 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
"mail",
"memberof",
"description",
+ "garage_s3_access_key",
FIELD_NAME_DIRECTORY_VISIBILITY,
FIELD_NAME_PROFILE_PICTURE,
},