Skip to content

Commit

Permalink
Create seperate package for feature flags (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke-Rogerson authored Dec 9, 2023
1 parent dec5614 commit 8738f09
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
environment:
- REDIS_URL=redis://db:6379/0
- PORT=8080
- VERIFY_SIGNATURE=true
depends_on:
- db
develop:
Expand Down
8 changes: 8 additions & 0 deletions featureflags/flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package featureflags

import "os"

// Enable/disable signature verification
//
// It is optional whether to verify the signature or not in the order book, as it will later be verified on-chain regardless.
var ShouldVerifySig = os.Getenv("VERIFY_SIGNATURE")
6 changes: 2 additions & 4 deletions service/create_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package service
import (
"context"
"fmt"
"os"
"time"

"github.com/google/uuid"
"github.com/orbs-network/order-book/featureflags"
"github.com/orbs-network/order-book/models"
"github.com/orbs-network/order-book/utils"
"github.com/orbs-network/order-book/utils/logger"
Expand All @@ -25,11 +25,9 @@ type CreateOrderInput struct {
Eip712MsgData map[string]interface{}
}

var shouldVerifySig = os.Getenv("VERIFY_SIGNATURE")

func (s *Service) CreateOrder(ctx context.Context, input CreateOrderInput) (models.Order, error) {

if shouldVerifySig == "" || shouldVerifySig == "true" {
if featureflags.ShouldVerifySig == "" || featureflags.ShouldVerifySig == "true" {
logctx.Info(ctx, "verifying signature", logger.String("userId", input.UserId.String()))

user := utils.GetUserCtx(ctx)
Expand Down

0 comments on commit 8738f09

Please sign in to comment.