Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triggering Maven profiles from Heroku configured Environment Variables

Tags:

maven

heroku

I am trying to activate a profile in my maven pom as follows:-

    <profile>
        <id>test</id>
        </properties>
        <activation>
            <property>
                <name>env.SITE</name>
                <value>test</value>
            </property>
        </activation>
    </profile>

Now i am configuring heroku to have the environment variable SITE as follows:-

heroku config:add SITE=test.

I expect the environment variable to trigger the profile when code is pushed. However this is not happening.

like image 692
VDev Avatar asked Jun 22 '12 18:06

VDev


1 Answers

You can do this without a custom build pack.

Use this snippet in your pom.xml to display all properties available on Heroku and pick one that is not in your local: http://florianlr.wordpress.com/2012/04/24/16/

I used env.DYNO

    <profile>
        <id>heroku</id>
        <activation>
            <property>
                <name>env.DYNO</name>
            </property>
        </activation>
    ...
    </profile>
    ...

Works like a charm:)

like image 120
Marcin Susel Avatar answered Oct 14 '22 16:10

Marcin Susel