authenticationopenxava

Is it possible to override naviox-users. properties file in production environment


For an initial pilot of a small app, I would like to keep a separate file for users name/passwords to be used in dev environment, and one for the prd environment.

Up to now, I have two files, and I copy manually the prd one to naviox-users.properties before creating the war.

Can you suggest a better strategy?


Solution

  • The easiest way is to redefine your createWar Ant target in the build.xml of your project, so it copies the production naviox-users files when creating the war. Something like this:

    <target name="createWar">
        <ant antfile="${openxava.base.dir}/OpenXava/build.xml" target="prepareWar"/>
        <copy file="../${project.name}/properties/naviox-users-for-production.properties" 
            toFile="../${project.name}/${classes.dir}/naviox-users.properties" 
            overwrite="yes"/>
        <jar jarfile="${dist.dir}/${name.war}.war" basedir="web"/>
    </target>               
    

    I didn't test the above code, it's just to give you a clue.