Is it possible to defer the environment variable resolving for preboot?

78 views
Skip to first unread message

Charlee Chitsuk

unread,
Jul 9, 2021, 11:32:11 PM7/9/21
to Payara Forum
Hi,

Regarding to the Types of variable references[1] which provides the reference to the environment variable. I've tried to use it with PayaraMicro via the preboot script as the following and it works like a charm.

1. At the OS

`export PAYARA_ACCESS_LOG_MAXIMUM_FILE_SIZE=104857600`

2. At the preboot script

`set configs.config.server-config.http-service.access-log.maximum-file-size=${ENV=PAYARA_ACCESS_LOG_MAXIMUM_FILE_SIZE}`

3. The result

The ` /tmp/payaramicro-<random>/configs/domain.xml ` has a `maximum-file-size="104857600"`. 

At this point, do we have anyway to make it  as `maximum-file-size=" ${ENV=PAYARA_ACCESS_LOG_MAXIMUM_FILE_SIZE}"` without resolving to the value and defer to resolve that variable during the PayaraMicro starting up instead?

Could you please help to advise?

Regards,

Charlee Ch.

Ondro Mihályi

unread,
Jul 10, 2021, 6:10:53 AM7/10/21
to Charlee Chitsuk, Payara Forum
Hi,

It's not possible. For 2 reasons

  • the variable reference is always translated when the postboot file is processed, there's no way to disable it. Even the resulting expressions is translated again and again until some level, so it doesn't help if the variable contains a reference to another variable, the other variable will again be translated before setting the property
  • even if was possible to avoid variable translation and pass an unmodified variable reference, the set command doesn't accept a textual value. This means it's possible to have variable reference in domain.xml (e.g. edit it manually) but not set the value to a variable reference using the set command. There's a validation constraint in the set command that doesn't allow it
Both reasons could be addressed by an improvement to Payara Micro, but at the current state, it's not possible to do what you want.

Ondro


so 10. 7. 2021 o 5:32 Charlee Chitsuk <charl...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/1643d761-6306-4180-84f3-e369b11b008cn%40googlegroups.com.

Charlee Chitsuk

unread,
Jul 10, 2021, 7:17:48 AM7/10/21
to Payara Forum
Hi Ondro,

Thank you very much for the explanation. 

My requirement seems like a big effort for a trivial thing. I will generate the `domain.xml` and edit it manually so that it is able to pass to the Payara Mirco via `--domainconfig` instead.

Regards,

Charlee Ch.

On Saturday, July 10, 2021 at 5:10:53 PM UTC+7 Ondro Mihályi wrote:
Hi,

It's not possible. For 2 reasons

  • the variable reference is always translated when the postboot file is processed, there's no way to disable it. Even the resulting expressions is translated again and again until some level, so it doesn't help if the variable contains a reference to another variable, the other variable will again be translated before setting the property
  • even if was possible to avoid variable translation and pass an unmodified variable reference, the set command doesn't accept a textual value. This means it's possible to have variable reference in domain.xml (e.g. edit it manually) but not set the value to a variable reference using the set command. There's a validation constraint in the set command that doesn't allow it
Both reasons could be addressed by an improvement to Payara Micro, but at the current state, it's not possible to do what you want.

Ondro


so 10. 7. 2021 o 5:32 Charlee Chitsuk :
Reply all
Reply to author
Forward
0 new messages