Announcement Announcement Module
Collapse
No announcement yet.
Literal dollar sign in tcServer template Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Literal dollar sign in tcServer template

    I'm creating a template with a property that should have the following value after the template is used to create an instance:

    Code:
    dev.http.port=${bio.http.port}
    When I put this in my property file in the template the tcruntime-instance script looks for a property named "bio.http.port", doesn't find it, and then the script fails.

    I've tried using

    Code:
    dev.http.port=\${bio.http.port}
    and

    Code:
    dev.http.port=$${bio.http.port}
    but get the same error every time.

    Does anyone know how to escape a ${} setting in a template configuration file?

  • #2
    What tc Server version are you using?

    Sounds like you are trying to create a property that already exists in another template. i.e. The bio template is what adds this property to catalina.properties file.

    Templating does not support shared properties across templates. But I can see where this could come in handy. I will create an enhancement ticket for escaping values for the case you have mentioned (when you know you want to use a specific collection of templates).

    For the time being you will need to supply the port number as set for bio template.

    Comment


    • #3
      Originally posted by Jason Konicki View Post
      What tc Server version are you using?

      Sounds like you are trying to create a property that already exists in another template. i.e. The bio template is what adds this property to catalina.properties file.

      Templating does not support shared properties across templates. But I can see where this could come in handy. I will create an enhancement ticket for escaping values for the case you have mentioned (when you know you want to use a specific collection of templates).

      For the time being you will need to supply the port number as set for bio template.
      Thanks for your response. I'm working with tcServer version 2.7.0.

      The need for this value comes from the development team and is used by internally by the application.

      Sharing properties across templates would provide a workaround for my issue, but isn't quite what I'm looking for. I'd like to generate a property file with the entry 'dev.http.port=${bio.http.port}'. To do this I need some way to escape the '$'. Is that possible?

      Comment


      • #4
        Originally posted by mzbrand View Post
        Sharing properties across templates would provide a workaround for my issue, but isn't quite what I'm looking for. I'd like to generate a property file with the entry 'dev.http.port=${bio.http.port}'. To do this I need some way to escape the '$'. Is that possible?
        But you are trying to share the value of bio.http.port with your template, are you not? BIO is it's own template that defines a property called http.port which then becomes bio.http.port when the template is installed.

        I'd like to generate a property file with the entry 'dev.http.port=${bio.http.port}'. To do this I need some way to escape the '$'. Is that possible?
        I assume you are using "dev.http.port" property placeholder to configure your instance using your own template. And you want it to be set to the same value as bio.http.port? If not, then I am unclear of why you would need to escape that.

        Also, when you say generate a property file, are you creating a new file or adding dev.http.port to the catalina.properties file?

        Comment


        • #5
          The urgent requirement that I have is to add the following to server.xml:

          Code:
             <Connector port="${bio.https.port}" protocol="HTTP/1.1" SSLEnabled="true"
          			maxThreads="150" scheme="https" secure="true"
          			clientAuth="false" sslProtocol="TLS" 
          			keystoreFile="conf/mykeystore"
          			keystorePass="mypassword" />
          We only want this in our dev environment (personal computers). I have tried several different ways to get around this, but so far nothing has worked.

          The command to create an instance would be:

          Code:
          tcruntime-instance.bat -t bio -t dev myinstance
          What's the recommended way to do this?

          Comment


          • #6
            First off, we already have a template for bio ssl, see bio-ssl template.

            But if you would like to use your own template, the way you should do this is the following:

            In your template "dev". Create a file called server-fragment.xml in the conf dir like this:
            Code:
            <?xml version='1.0' encoding='utf-8'?>
            <Server>
            	<Service name="Catalina">
            		<add:Connector port="${https.port:8443}" protocol="HTTP/1.1" SSLEnabled="true"
            					maxThreads="150" scheme="https" secure="true"
            					clientAuth="false" sslProtocol="TLS" 
            					keystoreFile="conf/mykeystore"
            					keystorePass="mypassword" />
            
            	</Service>
            </Server>
            By default on creation, if you don't pass in the properties on the command-line or in a properties file, it will set both bio.https.port and dev.https.ports to the default. In this case 8443 (see bio or bio-ssl template for the reference).

            In this execution I want my https port to be 9009, so I am telling it to set the property to 9009 for both templates:
            Code:
            tcruntime-instance.bat create -t bio -t dev -p bio.https.port=9009 -p dev.https.port=9009
            The result will be an instance create with both the bio connector and the dev connector in server.xml and you will have the properties bio.https.port=9009 and dev.https.port=9009 added to the catalina.properties file.

            Comment

            Working...
            X