by default, only listen on localhost
This commit is contained in:
parent
a253099725
commit
6f91b0810f
@ -16,6 +16,25 @@ var ApiTeamsRouting = map[string]DispatchFunction{
|
|||||||
"DELETE": deletionTeam,
|
"DELETE": deletionTeam,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func nginxGenMember() (string, error) {
|
||||||
|
if teams, err := fic.GetTeams(); err != nil {
|
||||||
|
return "", err
|
||||||
|
} else {
|
||||||
|
ret := ""
|
||||||
|
for _, team := range teams {
|
||||||
|
if members, err := team.GetMembers(); err == nil {
|
||||||
|
for _, member := range members {
|
||||||
|
ret += fmt.Sprintf(" if ($remote_user = \"%s\") { set $team \"%s\"; }\n", member.Nickname, team.InitialName)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func nginxGenTeam() (string, error) {
|
func nginxGenTeam() (string, error) {
|
||||||
if teams, err := fic.GetTeams(); err != nil {
|
if teams, err := fic.GetTeams(); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@ -107,6 +126,8 @@ func listTeam(args []string, body []byte) (interface{}, error) {
|
|||||||
return fic.GetTries(nil, nil)
|
return fic.GetTries(nil, nil)
|
||||||
} else if args[0] == "nginx" {
|
} else if args[0] == "nginx" {
|
||||||
return nginxGenTeam()
|
return nginxGenTeam()
|
||||||
|
} else if args[0] == "nginx-members" {
|
||||||
|
return nginxGenMember()
|
||||||
} else if args[0] == "binding" {
|
} else if args[0] == "binding" {
|
||||||
return bindingTeams()
|
return bindingTeams()
|
||||||
} else if tid, err := strconv.Atoi(string(args[0])); err != nil {
|
} else if tid, err := strconv.Atoi(string(args[0])); err != nil {
|
||||||
|
@ -19,7 +19,7 @@ var CloudUsername string
|
|||||||
var CloudPassword string
|
var CloudPassword string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var bind = flag.String("bind", "0.0.0.0:8081", "Bind port/socket")
|
var bind = flag.String("bind", "127.0.0.1:8081", "Bind port/socket")
|
||||||
var dsn = flag.String("dsn", "fic:fic@/fic", "DSN to connect to the MySQL server")
|
var dsn = flag.String("dsn", "fic:fic@/fic", "DSN to connect to the MySQL server")
|
||||||
flag.StringVar(&BaseURL, "baseurl", "http://fic.srs.epita.fr/", "URL prepended to each URL")
|
flag.StringVar(&BaseURL, "baseurl", "http://fic.srs.epita.fr/", "URL prepended to each URL")
|
||||||
flag.StringVar(&SubmissionDir, "submission", "./submissions/", "Base directory where save submissions")
|
flag.StringVar(&SubmissionDir, "submission", "./submissions/", "Base directory where save submissions")
|
||||||
|
@ -27,7 +27,7 @@ func touchStartedFile(startSub time.Duration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var bind = flag.String("bind", "0.0.0.0:8080", "Bind port/socket")
|
var bind = flag.String("bind", "127.0.0.1:8080", "Bind port/socket")
|
||||||
var prefix = flag.String("prefix", "", "Request path prefix to strip (from proxy)")
|
var prefix = flag.String("prefix", "", "Request path prefix to strip (from proxy)")
|
||||||
var start = flag.Int64("start", 0, fmt.Sprintf("Challenge start timestamp (in 2 minutes: %d)", time.Now().Unix()/60*60+120))
|
var start = flag.Int64("start", 0, fmt.Sprintf("Challenge start timestamp (in 2 minutes: %d)", time.Now().Unix()/60*60+120))
|
||||||
var duration = flag.Duration("duration", 180*time.Minute, "Challenge duration")
|
var duration = flag.Duration("duration", 180*time.Minute, "Challenge duration")
|
||||||
|
Loading…
Reference in New Issue
Block a user