add default of signature check from QUILIBRIUM_SIGNATURE_CHECK env var

This commit is contained in:
Marius Scurtescu 2024-06-05 14:37:50 -07:00
parent 58456c1057
commit a3ef5c6af2
3 changed files with 19 additions and 3 deletions

View File

@ -1,6 +1,7 @@
FROM golang:1.20.14-alpine3.19 as build FROM golang:1.20.14-alpine3.19 as build
ENV GOEXPERIMENT=arenas ENV GOEXPERIMENT=arenas
ENV QUILIBRIUM_SIGNATURE_CHECK=false
WORKDIR /opt/ceremonyclient WORKDIR /opt/ceremonyclient

View File

@ -7,7 +7,6 @@ services:
node: node:
image: ${QUILIBRIUM_IMAGE_NAME:-quilibrium} image: ${QUILIBRIUM_IMAGE_NAME:-quilibrium}
restart: unless-stopped restart: unless-stopped
command: ["--signature-check=false"]
deploy: deploy:
resources: resources:
limits: limits:

View File

@ -102,8 +102,8 @@ var (
) )
signatureCheck = flag.Bool( signatureCheck = flag.Bool(
"signature-check", "signature-check",
true, signatureCheckDefault(),
"enables or disables signature validation (default true)", "enables or disables signature validation (default true or value of QUILIBRIUM_SIGNATURE_CHECK env var)",
) )
core = flag.Int( core = flag.Int(
"core", "core",
@ -137,6 +137,20 @@ var signatories = []string{
"a114b061f8d35e3f3497c8c43d83ba6b4af67aa7b39b743b1b0a35f2d66110b5051dd3d86f69b57122a35b64e624b8180bee63b6152fce4280", "a114b061f8d35e3f3497c8c43d83ba6b4af67aa7b39b743b1b0a35f2d66110b5051dd3d86f69b57122a35b64e624b8180bee63b6152fce4280",
} }
func signatureCheckDefault() bool {
envVarValue, envVarExists := os.LookupEnv("QUILIBRIUM_SIGNATURE_CHECK")
if envVarExists {
def, err := strconv.ParseBool(envVarValue)
if err == nil {
return def
} else {
fmt.Println("Invalid environment variable QUILIBRIUM_SIGNATURE_CHECK, must be 'true' or 'false'. Got: " + envVarValue)
}
}
return true
}
func main() { func main() {
flag.Parse() flag.Parse()
@ -206,6 +220,8 @@ func main() {
fmt.Println("Signature check passed") fmt.Println("Signature check passed")
} }
} else {
fmt.Println("Signature check disabled, skipping...")
} }
if *memprofile != "" { if *memprofile != "" {