This repository was archived by the owner on Nov 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 33package licensing
44
55import (
6+ "crypto/sha256"
7+ "encoding/hex"
68 "fmt"
79 "github.com/google/uuid"
810 "github.com/rs/zerolog"
@@ -19,14 +21,33 @@ type LicenseModule struct {
1921}
2022
2123const (
22- installationIdFile = ".installation_id"
24+ installationIdFile = ".installation_id"
25+ quesmaAirGapModeEnvVar = "QUESMA_AIRGAP_KEY"
2326)
2427
28+ func isAirgapKeyValid (key string ) bool {
29+ hasher := sha256 .New ()
30+ hasher .Write ([]byte (key ))
31+ keyHash := hex .EncodeToString (hasher .Sum (nil ))
32+ return keyHash == "78b14371a310f4e4f7e6c19a444f771bbe5d2c4f2154715191334bcf58420435"
33+ }
34+
2535func Init (config * config.QuesmaConfiguration ) * LicenseModule {
2636 l := & LicenseModule {
2737 Config : config ,
2838 LicenseKey : []byte (config .LicenseKey ),
2939 }
40+ if airgapKey , isSet := os .LookupEnv (quesmaAirGapModeEnvVar ); isSet {
41+ if isAirgapKeyValid (airgapKey ) {
42+ l .logInfo ("Running Quesma in airgapped mode" )
43+ l .License = & License {
44+ InstallationID : "air-gapped-installation-id" ,
45+ ClientID : "air-gapped-client-id" ,
46+ }
47+ return l
48+ }
49+ }
50+ l .logInfo ("Initializing license module" )
3051 l .Run ()
3152 return l
3253}
You can’t perform that action at this time.
0 commit comments