Add a link for generation nginx certificate configuration
This commit is contained in:
parent
77fcaa39ff
commit
d841542be4
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
@ -23,10 +24,24 @@ type uploadedMember struct {
|
|||
Company string
|
||||
}
|
||||
|
||||
func nginxGenTeam() (string, error) {
|
||||
if teams, err := GetTeams(); err != nil {
|
||||
return "", err
|
||||
} else {
|
||||
ret := ""
|
||||
for _, team := range teams {
|
||||
ret += fmt.Sprintf(" if ($ssl_client_s_dn ~ \"/C=FR/ST=France/O=Epita/OU=SRS/CN=%s\") { set $team %d; }\n", team.Name, team.Id)
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
}
|
||||
|
||||
func listTeam(args []string, body []byte) (interface{}, error) {
|
||||
if len(args) == 1 {
|
||||
// List given team
|
||||
if tid, err := strconv.Atoi(string(args[0])); err != nil {
|
||||
if args[0] == "nginx" {
|
||||
return nginxGenTeam()
|
||||
} else if tid, err := strconv.Atoi(string(args[0])); err != nil {
|
||||
return nil, err
|
||||
} else if team, err := GetTeam(tid); err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue