User defined configuration parameters with OpenPetra.build.config: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
No edit summary
(Restructured and added hint regarding nant initConfigFiles)
Line 1: Line 1:
You can create your own configuration file, which will not be committed to bazaar, because the contents will be different for each developer.
You can define your own local (installation-specific) configuration settings such as


Just create a file called '''OpenPetra.build.config''' in your OpenPetra root directory, besides OpenPetra.build.
* database and credentials you use
* local paths for tools, etc.


You can overwrite every property, that you find in the NAnt build files, in OpenPetra.build or any of the xml files in inc\nant\. The properties usually have the attribute '''overwrite="false"''' which means your values from OpenPetra.build.config will overrule.
All the configuration options are set in NAnt build files, which are just simple xml files.
Just create a file ''OpenPetra.build.config'' in your OpenPetra root directory (the same directory you find the file ''OpenPetra.build'' in). As the contents will be different for each developer, it has aleady been marked in bazaar that it shall be ignored by version-control.


The shortest Postgree-SQL-example (If you use standard parameters ...):
The shortest Postgree-SQL-example for ''OpenPetra.build.config'' (If you use standard parameters ...):
<pre>
<pre>
<?xml version="1.0"?>
<?xml version="1.0"?>
Line 16: Line 18:
</pre>
</pre>


An more complex example:
A more complex example:
<pre>
<pre>
<?xml version="1.0"?>
<?xml version="1.0"?>
Line 24: Line 26:
     <property name="pgdump.exe" value="C:\Program Files/PostgreSQL/9.0/bin/pg_dump.exe" overwrite="false"/>
     <property name="pgdump.exe" value="C:\Program Files/PostgreSQL/9.0/bin/pg_dump.exe" overwrite="false"/>
     <property name="DBMS.DBName" value="myopenpetradb"/>
     <property name="DBMS.DBName" value="myopenpetradb"/>
     <property name="DBMS.Password" value="secret" />
    <property name="DBMS.UserName" value="myusername"/>
     <property name="DBMS.Password" value="secret"/>
     <property name="projectfiles.templates-list" value="sharpdevelop3"/>
     <property name="projectfiles.templates-list" value="sharpdevelop3"/>
</project>
</project>
</pre>
</pre>


Explanation of this example:
'''Important: after you changed any settings in the config-file, you have to run "nant initConfigFiles".'''
* this developer wants to work with PostgreSQL instead of the default SQLite. Therefore you must set the DBMS.Type property.
 
* Usually, the psql.exe and pg_dump.exe are located by default in the Program Files directory, but in the case of 64bit Windows, the default Program Files directory for nant is "Program Files (x86)", where Postgresql is not installed in my case.
Explanation of the above example:
* You have the option to define a different database, and also a different database password
* Database-System: this developer wants to work with PostgreSQL instead of the default SQLite. Therefore you must set the DBMS.Type property.
* '''projectfiles.templates-list''': if you are only using SharpDevelop anyway, there is no need to create project files and solution file(s) for Visual Studio. By default, project files are generated for both IDEs.
* File-Locations: Usually, the psql.exe and pg_dump.exe are located by default in the Program Files directory, but in the case of 64bit Windows, the default Program Files directory for nant is "Program Files (x86)", where Postgresql is not installed in my case.
* Database: You have the option to define a different database, it's user and password
* ''projectfiles.templates-list'': if you are only using SharpDevelop anyway, there is no need to create project files and solution file(s) for Visual Studio. By default, project files are generated for both IDEs.
 
== Finding changeable properties ==
 
The configuration files where the default settings are set include:
 
* any of the xml files in inc\nant\ (defines default values)
* The file '''OpenPetra.build''' in the OpenPetra root directory (defines default values)
 
Just browse these files and find the properties you need to fit your configuration. Just copy the property into '''OpenPetra.build.config''' and alter it's value. The settings in '''OpenPetra.build.config''' (typically) override the default settings in these files. You can check this by looking if the original definition of the property has an attribute '''overwrite="false"''', which then shows that your values from OpenPetra.build.config will be given precedence.

Revision as of 15:05, 12 April 2011

You can define your own local (installation-specific) configuration settings such as

  • database and credentials you use
  • local paths for tools, etc.

All the configuration options are set in NAnt build files, which are just simple xml files. Just create a file OpenPetra.build.config in your OpenPetra root directory (the same directory you find the file OpenPetra.build in). As the contents will be different for each developer, it has aleady been marked in bazaar that it shall be ignored by version-control.

The shortest Postgree-SQL-example for OpenPetra.build.config (If you use standard parameters ...):

<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
    <property name="DBMS.Type" value="postgresql"/>
    <property name="PostgreSQL.exe" value="C:\Program Files/PostgreSQL/9.0/bin/psql.exe"/>
    <property name="pgdump.exe" value="C:\Program Files/PostgreSQL/9.0/bin/pg_dump.exe" overwrite="false"/>
    <property name="projectfiles.templates-list" value="sharpdevelop3"/>
</project>

A more complex example:

<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
    <property name="DBMS.Type" value="postgresql"/>
    <property name="PostgreSQL.exe" value="C:\Program Files/PostgreSQL/9.0/bin/psql.exe"/>
    <property name="pgdump.exe" value="C:\Program Files/PostgreSQL/9.0/bin/pg_dump.exe" overwrite="false"/>
    <property name="DBMS.DBName" value="myopenpetradb"/>
    <property name="DBMS.UserName" value="myusername"/>
    <property name="DBMS.Password" value="secret"/>
    <property name="projectfiles.templates-list" value="sharpdevelop3"/>
</project>

Important: after you changed any settings in the config-file, you have to run "nant initConfigFiles".

Explanation of the above example:

  • Database-System: this developer wants to work with PostgreSQL instead of the default SQLite. Therefore you must set the DBMS.Type property.
  • File-Locations: Usually, the psql.exe and pg_dump.exe are located by default in the Program Files directory, but in the case of 64bit Windows, the default Program Files directory for nant is "Program Files (x86)", where Postgresql is not installed in my case.
  • Database: You have the option to define a different database, it's user and password
  • projectfiles.templates-list: if you are only using SharpDevelop anyway, there is no need to create project files and solution file(s) for Visual Studio. By default, project files are generated for both IDEs.

Finding changeable properties

The configuration files where the default settings are set include:

  • any of the xml files in inc\nant\ (defines default values)
  • The file OpenPetra.build in the OpenPetra root directory (defines default values)

Just browse these files and find the properties you need to fit your configuration. Just copy the property into OpenPetra.build.config and alter it's value. The settings in OpenPetra.build.config (typically) override the default settings in these files. You can check this by looking if the original definition of the property has an attribute overwrite="false", which then shows that your values from OpenPetra.build.config will be given precedence.