How to properly read parameters from the yamcs.$project.yaml configuration

6 views
Skip to first unread message

Patrick Dohmen

unread,
5:46 AM (10 hours ago) 5:46 AM
to yamcs
Hello group,

I am struggling while trying to read the configuration of the parameters to my CommandPostProcessor.

Trying to read the following does not work:

// Load secret key from configuration
if (config.containsKey("secretKey")) {
this.secretKey = config.getString("secretKey");
} else {
// Consider loading from environment variable as a more secure alternative
this.secretKey = System.getenv("YAMCS_HMAC_SECRET_KEY");
if (this.secretKey == null) {
throw new IllegalArgumentException(
"HMAC secret key must be provided via 'secretKey' config or YAMCS_HMAC_SECRET_KEY environment variable");
}
}

The configuration is as follows:

virtualChannels:
- vcId: 0 # VCID_MANAGEMENT
service: "PACKET"
commandPostprocessorClassName: com.erminaz.MyCommandPostprocessor
#commandPostprocessorArgs:
args:
secretKey: "your-base64-secret-key"
algorithm: "HmacSHA256"
#hmacLength: 16 # Optional: truncate to 16 bytes

I've just attached to most interesting parts for readability, if you're suggesting that the mistake I am doing is somewhere else in those files I can link to a repository.

Best regards,
Patrick, DL4PD

Reply all
Reply to author
Forward
0 new messages