Skip to content

Commit

Permalink
Disabled tasks endpoint for doctorX distribution. (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-myles authored Dec 2, 2024
1 parent 10f5fdc commit 8a7aa02
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
9 changes: 9 additions & 0 deletions cmd/santa-sleigh/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package main

import (
"github.com/pkg/errors"

"github.com/ice-blockchain/santa/badges"
friendsinvited "github.com/ice-blockchain/santa/friends-invited"
levelsandroles "github.com/ice-blockchain/santa/levels-and-roles"
Expand Down Expand Up @@ -35,6 +37,13 @@ const (
taskNotCompletedCode = "TASK_NOT_COMPLETED"
)

// .
var (
//nolint:gochecknoglobals // Because its loaded once, at runtime.
cfg config
errForbidden = errors.New("disabled")
)

type (
// | service implements server.State and is responsible for managing the state and lifecycle of the package.
service struct {
Expand Down
1 change: 0 additions & 1 deletion cmd/santa-sleigh/santa_sleigh.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

var cfg config
appcfg.MustLoadFromKey(applicationYamlKey, &cfg)
api.SwaggerInfo.Host = cfg.Host
api.SwaggerInfo.Version = cfg.Version
Expand Down
3 changes: 3 additions & 0 deletions cmd/santa-sleigh/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func (s *service) PseudoCompleteTask( //nolint:gocritic // False negative.
ctx context.Context,
req *server.Request[CompleteTaskRequestBody, any],
) (*server.Response[any], *server.Response[server.ErrorResponse]) {
if cfg.Tenant == "doctorx" {
return nil, server.Forbidden(errForbidden)
}
task := &tasks.Task{
Data: req.Data.Data,
Type: req.Data.TaskType,
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ require (
golang.org/x/tools v0.27.0 // indirect
google.golang.org/api v0.209.0 // indirect
google.golang.org/appengine/v2 v2.0.6 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto v0.0.0-20241202173237-19429a94021a // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect
google.golang.org/grpc v1.68.0 // indirect
google.golang.org/grpc/stats/opentelemetry v0.0.0-20241028142157-ada6787961b3 // indirect
google.golang.org/protobuf v1.35.2 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,12 @@ google.golang.org/appengine/v2 v2.0.6/go.mod h1:WoEXGoXNfa0mLvaH5sV3ZSGXwVmy8yf7
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk=
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697/go.mod h1:JJrvXBWRZaFMxBufik1a4RpFw4HhgVtBBWQeQgUj2cc=
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 h1:pgr/4QbFyktUv9CtQ/Fq4gzEE6/Xs7iCXbktaGzLHbQ=
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697/go.mod h1:+D9ySVjN8nY8YCVjc5O7PZDIdZporIDY3KaGfJunh88=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 h1:LWZqQOEjDyONlF1H6afSWpAL/znlREo2tHfLoe+8LMA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/genproto v0.0.0-20241202173237-19429a94021a h1:4voejwOVTsjw6IMfnGt8IzTQBIw45hP8S0e77UMounA=
google.golang.org/genproto v0.0.0-20241202173237-19429a94021a/go.mod h1:dW27OyXi0Ph+N43jeCWMFC86aTT5VgdeQtOSf0Hehdw=
google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a h1:OAiGFfOiA0v9MRYsSidp3ubZaBnteRUyn3xB2ZQ5G/E=
google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a/go.mod h1:jehYqy3+AhJU9ve55aNOaSml7wUXjF9x6z2LcCfpAhY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
Expand Down

0 comments on commit 8a7aa02

Please sign in to comment.