Find the answer to your Linux question:
Results 1 to 6 of 6
Are there any standards for application configuration files on Linux? Furthermore, are there any libraries available to work with those formats? Basically, is there a lib I could use to ...
  1. #1
    Linux Newbie
    Join Date
    Aug 2005
    Location
    Sterling, VA
    Posts
    100

    Config File Standards

    Are there any standards for application configuration files on Linux? Furthermore, are there any libraries available to work with those formats?

    Basically, is there a lib I could use to create my own apache-style configuration file, or something along those lines?

    Thanks,

    Dave
    - EndianX -

  2. #2
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    What kind of application are we talking about here? Would a .conf file be sufficient or do you need something more sophisticated?

    I'm not sure about C/C++ but if you're using Java, there are tons of options out there if you're willing to go with XML. JAXB is one but if you're familiar with Apache, you might also be familiar with xerces which is a very nice XML parser for Java. Once you get the framework built with Xerces, it's almost a trivial task to parse a config.

  3. #3
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    Advice that I follow:
    Don't use XML as your configuration file format. It may be
    human-readable, but it's almost never human-understandable, and
    the ratio of mark-up to content is vastly too high.

    All three of these alternatives [ Config::{General,Std,Tiny} ]
    allow you to read configuration files into an internal data
    structure, update that data structure, and then write it back out
    in the appropriate configuration file syntax.

    Perl Best Practices, D Conway, O'Reilly, 2005; page 445 ff.
    cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  4. #4
    Linux Newbie
    Join Date
    Aug 2005
    Location
    Sterling, VA
    Posts
    100
    Thanks guys.

    XML is a possibility, but I rarely see it used. I'm hoping for something more common.

    Config::{General,Std,Tiny} sounds great, but perl specific. Anybody know of something similar for C?

    Thanks again,

    Dave
    - EndianX -

  5. #5
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    Never used it, but:
    Code:
    Description: Configuration file parser library - runtime files
     dot.conf is a simple-to-use and powerful configuration-file parser
     library written in C. The configuration files created for dot.conf
     look very similar to those used by the Apache Webserver. Even
     Container-Directives known from httpd.conf can easily be used in the
     exact same manner as for Apache-Modules. It supports various types of
     arguments, dynamically loadable modules that create their own
     configuration options on-the-fly, a here-documents feature to pass
     very long ARG_STR data to your app, and on-the-fly inclusion of
     additional config files.
    Tag: devel::library, implemented-in::c, role::shared-lib, use::configuring
    
    -- apt-cache show libdotconf1.0
    On Debian:
    Code:
    apt-cache search config|grep '^lib'|grep -v perl
    Produces almost 300 hits, but includes Ruby, Java, etc. libraries ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  6. #6
    Linux Engineer Thrillhouse's Avatar
    Join Date
    Jun 2006
    Location
    Arlington, VA, USA
    Posts
    1,377
    Quote Originally Posted by drl
    Hi.

    Advice that I follow:
    Quote:
    Don't use XML as your configuration file format. It may be
    human-readable, but it's almost never human-understandable, and
    the ratio of mark-up to content is vastly too high.
    That may be true for Perl but I still believe XML is a viable alternative for Java applications. Yes, there is some markup in XML but that markup provides some nice functionality that's not easily provided by other implementations. Besides, the extra markup in most cases probably does not even amount to 1k.

    Also, I find XML to be no less understandable than other formats. And what's even more important is that the config is application-understandable which is certainly true of XML where config values are clearly delimited, as opposed to other formats where they may not be.

    Anyways, EndianX, I hope you find what you're looking for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...