Add a link for generation nginx certificate configuration
This commit is contained in:
parent
77fcaa39ff
commit
d841542be4
1 changed files with 17 additions and 2 deletions
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,10 +24,24 @@ type uploadedMember struct {
|
||||||
Company string
|
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) {
|
func listTeam(args []string, body []byte) (interface{}, error) {
|
||||||
if len(args) == 1 {
|
if len(args) == 1 {
|
||||||
// List given team
|
if args[0] == "nginx" {
|
||||||
if tid, err := strconv.Atoi(string(args[0])); err != nil {
|
return nginxGenTeam()
|
||||||
|
} else if tid, err := strconv.Atoi(string(args[0])); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if team, err := GetTeam(tid); err != nil {
|
} else if team, err := GetTeam(tid); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Reference in a new issue