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

From OpenPetra Wiki
Jump to navigation Jump to search
(Add comments on file location specification for PostgreSQL and MySql)
 
(4 intermediate revisions by 3 users not shown)
Line 11: Line 11:
<?xml version="1.0"?>
<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
<project name="OpenPetra-userconfig">
    <property name="PostgreSQL.Version" value="9.1"/> <!-- 9.0 is still the default -->
     <property name="DBMS.Type" value="postgresql"/>
     <property name="DBMS.Type" value="postgresql"/>
</project>
</project>
Line 28: Line 27:
<?xml version="1.0"?>
<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
<project name="OpenPetra-userconfig">
     <property name="PostgreSQL.Version" value="9.1"/> <!-- 9.0 is still the default -->
     <property name="PostgreSQL.Version" value="9.3"/>
     <property name="PostgreSQL.exe" value="D:\Program Files\PostgreSQL\9.2\bin\psql.exe" />
     <property name="PostgreSQL.exe" value="D:\Program Files\PostgreSQL\9.3\bin\psql.exe" />
     <property name="DBMS.Type" value="postgresql"/>
     <property name="DBMS.Type" value="postgresql"/>
     <property name="DBMS.DBName" value="myopenpetradb"/>
     <property name="DBMS.DBName" value="myopenpetradb"/>
Line 35: Line 34:
     <property name="DBMS.Password" value="secret"/>
     <property name="DBMS.Password" value="secret"/>
     <property name="projectfiles.templates-list" value="sharpdevelop4" />
     <property name="projectfiles.templates-list" value="sharpdevelop4" />
    <property name="Server.DebugLevel" value="0"/>
</project>
</project>
</pre>
</pre>
Line 52: Line 52:
* Database-System: this developer wants to work with PostgreSQL instead of the default SQLite. Therefore you must set the DBMS.Type property.
* 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.  PostgreSQL.exe can be used to specify file locations when they are not in the default location.  (Note: The equivalent entry for MySQL would be '<property name="MySQL.exe" value="D:\Program Files\...\bin\mysql.exe" />'
* 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.  PostgreSQL.exe can be used to specify file locations when they are not in the default location.  (Note: The equivalent entry for MySQL would be '<property name="MySQL.exe" value="D:\Program Files\...\bin\mysql.exe" />'
* Database: You have the option to define a different database, it's user and password
* Database: You have the option to define a different database, its user and password
* See [[Notes_about_PostgreSQL]] for more information about PostgreSQL setup
* See [[Notes_about_PostgreSQL]] for more information about PostgreSQL setup
* ''projectfiles.templates-list'': see [[Build system with our own NAnt tools and tasks|nant generateProjectFiles]]
* ''projectfiles.templates-list'': see [[Build system with our own NAnt tools and tasks|nant generateProjectFiles]]
Line 59: Line 59:
Check these configuration files where the default settings are set:
Check these configuration files where the default settings are set:


* inc\nant\OpenPetra.common.xml
* [https://github.com/openpetra/openpetra/blob/master/inc/nant/OpenPetra.common.xml inc\nant\OpenPetra.common.xml]
* inc\nant\OpenPetra.tobe.migrated.xml
* [https://github.com/openpetra/openpetra/blob/master/inc/nant/OpenPetra.tobe.migrated.xml inc\nant\OpenPetra.tobe.migrated.xml]


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 appropriately.
Just browse these files and find the properties you need to fit your configuration. Just copy the property into '''OpenPetra.build.config''' and alter its value appropriately.

Latest revision as of 06:38, 6 October 2016

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 PostgreSQL-example for OpenPetra.build.config for windows (If you use standard parameters ...):

<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
    <property name="DBMS.Type" value="postgresql"/>
</project>

For Linux it would be:

<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
    <property name="DBMS.Type" value="postgresql"/>
</project>

A more complex example:

<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
    <property name="PostgreSQL.Version" value="9.3"/>
    <property name="PostgreSQL.exe" value="D:\Program Files\PostgreSQL\9.3\bin\psql.exe" />
    <property name="DBMS.Type" value="postgresql"/>
    <property name="DBMS.DBName" value="myopenpetradb"/>
    <property name="DBMS.UserName" value="myusername"/>
    <property name="DBMS.Password" value="secret"/>
    <property name="projectfiles.templates-list" value="sharpdevelop4" />
    <property name="Server.DebugLevel" value="0"/>
</project>

An example for SQLite (note: empty password required on Windows):

<?xml version="1.0"?>
<project name="OpenPetra-userconfig">
    <property name="DBMS.Type" value="sqlite"/>
    <property name="DBMS.Password" value=""/>
</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. PostgreSQL.exe can be used to specify file locations when they are not in the default location. (Note: The equivalent entry for MySQL would be '<property name="MySQL.exe" value="D:\Program Files\...\bin\mysql.exe" />'
  • Database: You have the option to define a different database, its user and password
  • See Notes_about_PostgreSQL for more information about PostgreSQL setup
  • projectfiles.templates-list: see nant generateProjectFiles

Finding changeable properties

Check these configuration files where the default settings are set:

Just browse these files and find the properties you need to fit your configuration. Just copy the property into OpenPetra.build.config and alter its value appropriately.