Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

JSON support for AEM as Cloud service environment variables

Avatar

Level 6

Hi All,

 

Is there anything down the line to make environment variables more flexible to allow like a JSON of Strings?

 

That way we don't have to maintain separate variables for doing similar operations for different sites. e.g. I can have ten loggers writing to error.log but would want to set only one of them to Debug at a given point in time. Currently, I would need an environment variable for each Logger or a generic Log Level variable that will set all logs to same level. Changing generic variable level to Debug will set it for all ten sites at once which may not be the intention.

 

Is there anything already available to achieve such a use case?

 

Thanks,

Ram

2 Replies

Avatar

Employee

@rampai I'm not sure how it relates to the use case you're describing, but aside from length limitations, there's no reason you can't store a JSON object encoded as a String in an environment variable. The only issue I can imagine is that when using the Cloud Manager CLI it might be hard to get the escaping right on the command line. In this context the --jsonStdin or --jsonFile flags might be easier to work with.

Avatar

Level 6

Hi @justin_at_adobe2 ,

 

Thanks for your response.

 

Do you mean something like this?

LOG_LEVEL = "{\"siteA\":\"info\",\"siteB\":\"debug\",\"siteC\":\"warn\"}"

 

Even if this works, is something like "$[env:LOG_LEVEL.siteA;default=info]" supported? Please can you share any references if it is.

 

My use case is, if I am having a sizable number of applications on AEM and given we have a limit of 200 variables per instance, the log level itself can contribute to the number if we keep one such string per application.

 

Thanks,

Ram