vegemite4me
vegemite4me

Reputation: 6856

Can Alfresco replace place holders with environment values?

I am not an Alfresco user, so please excuse me if I use the wrong terminology. I have tried searching for this, but could not find the answer - as maybe it is not possible.

I have an static HTML page which I need to deploy to a a dev, staging and production server. The page contains a link, and this link should point to a different URL depending on the environment the HTML page is deployed to.

e.g. test.html looks like this, and I add/commit/upload this to Alfresco.

<html>
....
    <a href="{{LOGIN-URL}}">Log In</a>
....
</html>

And I then have properties such as this:

dev.LOGIN-URL=http://dev.example.com
stg.LOGIN-URL=http://stg.example.com
prod.LOGIN-URL=http://www.example.com

Is it possible for Alfresco to replace the placeholder with the correct value for that environment when the document is published?

Or can this be done another way?

Upvotes: 1

Views: 53

Answers (1)

alfrescian
alfrescian

Reputation: 4079

Nice question - You can define your stage by passing in a property via jvm args (http://docs.alfresco.com/4.2/topic/com.alfresco.enterprise.doc/tasks/bean-override.html):

-Dstage=dev or -Dstage=prod

in your properties:

dev.LOGIN-URL=http://dev.example.com
stg.LOGIN-URL=http://stg.example.com
prod.LOGIN-URL=http://www.example.com

In your template:

<html>
    ....
        <a href="{{STAGE}}.{{LOGIN-URL}}">Log In</a>
    ....
</html>

Upvotes: 1

Related Questions