Skip to content

Commit

Permalink
fix v2config
Browse files Browse the repository at this point in the history
  • Loading branch information
lab committed Jul 10, 2024
1 parent 60414df commit 5220921
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/flags/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (f *Flags) handleActivateCommand() error {
f.amtActivateCommand.BoolVar(&f.SkipIPRenew, "skipIPRenew", false, "skip DHCP renewal of the IP address if AMT becomes enabled")
// for local activation in ACM mode need a few more items
f.amtActivateCommand.StringVar(&f.configContent, "config", "", "specify a config file or smb: file share URL")
f.amtActivateCommand.StringVar(&f.configContent, "configv2", "", "specify a config file or smb: file share URL")
f.amtActivateCommand.StringVar(&f.configContentV2, "configv2", "", "specify a config file or smb: file share URL")
f.amtActivateCommand.StringVar(&f.LocalConfig.ACMSettings.AMTPassword, "amtPassword", f.lookupEnvOrString("AMT_PASSWORD", ""), "amt password")
f.amtActivateCommand.StringVar(&f.LocalConfig.ACMSettings.ProvisioningCert, "provisioningCert", f.lookupEnvOrString("PROVISIONING_CERT", ""), "provisioning certificate")
f.amtActivateCommand.StringVar(&f.LocalConfig.ACMSettings.ProvisioningCertPwd, "provisioningCertPwd", f.lookupEnvOrString("PROVISIONING_CERT_PASSWORD", ""), "provisioning certificate password")
Expand Down
2 changes: 2 additions & 0 deletions internal/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,7 @@ func (f *Flags) handleLocalConfigV2() error {
return err
}

fmt.Println(content)
f.LocalConfigV2 = content
return nil
}
6 changes: 4 additions & 2 deletions pkg/config/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/base64"
"errors"
"io/ioutil"
"fmt"

"gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -42,16 +43,17 @@ func Decrypt(cipherText string, key []byte) ([]byte, error) {

// Read encrypted data from file and decrypt it
func ReadAndDecryptFile(filePath string, key []byte) (Configuration, error) {
fmt.Println(filePath)
encryptedData, err := ioutil.ReadFile(filePath)
if err != nil {
return Configuration{}, err
}

fmt.Println(encryptedData)
decryptedData, err := Decrypt(string(encryptedData), key)
if err != nil {
return Configuration{}, err
}

fmt.Println(decryptedData)
var configuration Configuration
err = yaml.Unmarshal(decryptedData, &configuration)
if err != nil {
Expand Down

0 comments on commit 5220921

Please sign in to comment.