Skip to content
Snippets Groups Projects
Unverified Commit a5a8a126 authored by Manish R Jain's avatar Manish R Jain
Browse files

Have a flag to forbit mutations on a server. Very useful for the live demo, or...

Have a flag to forbit mutations on a server. Very useful for the live demo, or other read-only situations.
parent 480b1337
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,7 @@ var instanceIdx = flag.Uint64("instanceIdx", 0,
"serves only entities whose Fingerprint % numInstance == instanceIdx.")
var workers = flag.String("workers", "",
"Comma separated list of IP addresses of workers")
var nomutations = flag.Bool("nomutations", false, "Don't allow mutations on this server.")
func addCorsHeaders(w http.ResponseWriter) {
w.Header().Set("Access-Control-Allow-Origin", "*")
......@@ -68,6 +69,10 @@ func addCorsHeaders(w http.ResponseWriter) {
}
func mutationHandler(mu *gql.Mutation) error {
if *nomutations {
return fmt.Errorf("Mutations are forbidden on this server.")
}
r := strings.NewReader(mu.Set)
scanner := bufio.NewScanner(r)
var nquads []rdf.NQuad
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment