Best practices for config files
Ryan Schmidt
ryandesign at macports.org
Mon Feb 23 17:40:49 PST 2009
On Feb 23, 2009, at 19:29, Ryan Schmidt wrote:
> I suggest you install multiple sample config files and allow the
> user to choose which of them to copy into place.
For example, consider mysql5 which provides you with these files:
$ port contents mysql5 | grep cnf
/opt/local/share/mysql5/mysql/my-huge.cnf
/opt/local/share/mysql5/mysql/my-innodb-heavy-4G.cnf
/opt/local/share/mysql5/mysql/my-large.cnf
/opt/local/share/mysql5/mysql/my-medium.cnf
/opt/local/share/mysql5/mysql/my-small.cnf
$
You can copy any of those sample config files to /opt/local/etc/
mysql5/my.cnf to use them, and then customize them further.
apache2 does this as well:
$ port contents apache2 | grep original
/opt/local/apache2/conf/original/extra/httpd-autoindex.conf
/opt/local/apache2/conf/original/extra/httpd-dav.conf
/opt/local/apache2/conf/original/extra/httpd-default.conf
/opt/local/apache2/conf/original/extra/httpd-info.conf
/opt/local/apache2/conf/original/extra/httpd-languages.conf
/opt/local/apache2/conf/original/extra/httpd-manual.conf
/opt/local/apache2/conf/original/extra/httpd-mpm.conf
/opt/local/apache2/conf/original/extra/httpd-multilang-errordoc.conf
/opt/local/apache2/conf/original/extra/httpd-ssl.conf
/opt/local/apache2/conf/original/extra/httpd-userdir.conf
/opt/local/apache2/conf/original/extra/httpd-vhosts.conf
/opt/local/apache2/conf/original/httpd.conf
$
Again, the user is meant to copy any desired config file from /opt/
local/apache2/conf/original into /opt/local/apache2/conf and then
edit it to suit.
Both of these ports leave the sample config files exactly as upstream
provided them (in a separate directory, not renaming the files with
the ".sample" extension). For software that does not already do that
out of the box, the portfile author is expected to take similar
measures (either put sample config files in a different directory or
give them an extension that makes it obvious they are samples and not
the real file the software will use).
More information about the macports-users
mailing list