go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/teams/main.go (about) 1 // Copyright 2023 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package main 16 17 import ( 18 "go.chromium.org/luci/grpc/prpc" 19 "go.chromium.org/luci/server" 20 "go.chromium.org/luci/server/cron" 21 "go.chromium.org/luci/server/gaeemulation" 22 "go.chromium.org/luci/server/module" 23 "go.chromium.org/luci/server/secrets" 24 spanmodule "go.chromium.org/luci/server/span" 25 "go.chromium.org/luci/server/tq" 26 27 "go.chromium.org/luci/teams/internal/span" 28 pb "go.chromium.org/luci/teams/proto/v1" 29 "go.chromium.org/luci/teams/rpc" 30 31 _ "go.chromium.org/luci/server/encryptedcookies/session/datastore" 32 _ "go.chromium.org/luci/server/tq/txn/datastore" 33 ) 34 35 func main() { 36 // Additional modules that extend the server functionality. 37 modules := []module.Module{ 38 cron.NewModuleFromFlags(), 39 gaeemulation.NewModuleFromFlags(), 40 secrets.NewModuleFromFlags(), 41 tq.NewModuleFromFlags(), 42 spanmodule.NewModuleFromFlags(nil), 43 } 44 45 server.Main(nil, modules, func(srv *server.Server) error { 46 srv.ConfigurePRPC(func(s *prpc.Server) { 47 s.AccessControl = prpc.AllowOriginAll 48 // TODO(crbug/1082369): Remove this workaround once field masks can be decoded. 49 s.HackFixFieldMasksForJSON = true 50 }) 51 srv.RegisterUnaryServerInterceptors(span.SpannerDefaultsInterceptor()) 52 53 pb.RegisterTeamsServer(srv, rpc.NewTeamsServer()) 54 55 // TODO: Register any cron jobs here: 56 // cron.RegisterHandler("update-config", ...) 57 return nil 58 }) 59 }