Tcl API Reference -- ns_config

### ns_config

#### Overview

Extract information from the configuration file

#### Syntax

ns_config ?-exact | -bool | -int? section key ?default?

#### Description

The ns_config function returns the value associated with the key in the specified section of the configuration file. If the default argument is specified, and the specified section and key aren't found in the configuration file, the specified default is returned. If the default argument is not specified in this situation, "" is returned.

If -exact is specified, matching on key is case-sensitive. By default matching is case-insensitive.

If -bool is specified, ns_config will perform the conversion of a boolean value from "on", "1", "y", "yes", "t", and "true" to "1", and it will convert a boolean value of "off", "0", "n", "no", "f", and "false" to "0". If a boolean contains any other value, a warning is written to the log file and an empty string {"") is returned. If no value is specified in the configuration file for the specified key, an empty string ("") is returned.

If -int is specified, ns_config will return the integer value of the specified key. If there is a non-integer value in the configuration file, a warning is written to the log file and an empty string ("") is returned.

#### Example

        set path ns/server/myserver
        set xyz [ns_config -bool $path Verbose 1]

Top of Page
Copyright © 1998-99 America Online, Inc.