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
ENV GOEXPERIMENT=arenas
ENV QUILIBRIUM_SIGNATURE_CHECK=false
WORKDIR /opt/ceremonyclient

View File

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

View File

@ -102,8 +102,8 @@ var (
)
signatureCheck = flag.Bool(
"signature-check",
true,
"enables or disables signature validation (default true)",
signatureCheckDefault(),
"enables or disables signature validation (default true or value of QUILIBRIUM_SIGNATURE_CHECK env var)",
)
core = flag.Int(
"core",
@ -137,6 +137,20 @@ var signatories = []string{
"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() {
flag.Parse()
@ -206,6 +220,8 @@ func main() {
fmt.Println("Signature check passed")
}
} else {
fmt.Println("Signature check disabled, skipping...")
}
if *memprofile != "" {