Configuration file
In computing, configuration files (commonly known simply as config files) are files used to configure the parameters and initial settings for some computer programs or applications, server processes and operating system settings.
Some applications provide tools to create, modify, and verify the syntax of their configuration files; these sometimes have graphical interfaces. For other programs, system administrators may be expected to create and modify files by hand using a text editor, which is possible because many are human-editable plain text files. For server processes and operating-system settings, there is often no standard tool, but operating systems may provide their own graphical interfaces such as YaST or debconf.
Some computer programs only read their configuration files at startup. Others periodically check the configuration files for changes. Users can instruct some programs to re-read the configuration files and apply the changes to the current process, or indeed to read arbitrary files as a configuration file. There are no definitive standards or strong conventions.
Configuration files and operating systems
Unix and Unix-like operating systems
Across
.cnf
, .conf
, .cfg
, .cf
or .ini
are often used.
Almost all formats allow
System-wide software often uses configuration files stored in .config
directory, a standardized subdirectory of the home directory.
Some configuration files run a set of commands upon startup. A common convention is for such files to have "rc
" in their name,
By contrast,
MS-DOS
An example CONFIG.SYS for MS-DOS 5:
DOS=HIGH,UMB
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE RAM
DEVICEHIGH=C:\DOS\ANSI.SYS
FILES=30
SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P
DOS applications used a wide variety of individual configuration files, most of them binary, proprietary and undocumented - and there were no common conventions or formats.[citation needed]
Microsoft Windows
The early Microsoft Windows family of operating systems heavily utilized plain-text INI files (from "initialization"). These served as the primary mechanism to configure the operating system and application features.[4] The APIs to read and write from these still exist in Windows, but after 1993, Microsoft began to steer developers away from using INI files and toward storing settings in the Windows Registry, a hierarchical database to store configuration settings, which was introduced that year with Windows NT.
macOS
The
.plist
.
IBM OS/2
IBM's
HarmonyOS and OpenHarmony operating systems
config.json
: the code editing view and the visual editing view. The `app` object holds the universal configuration details for the application, as demonstrated in the config.json
configuration file of HarmonyOS's foundational application. DeviceConfig
encompasses the configuration details for specific devices, including default, Phone, Tablet, PC, TV, Car, Wearable, liteWearable, and smartVision. The settings under the default label apply to all devices. If there are unique requirements for other devices, the settings under the respective device type label need to be configured. The Module
object carries the HAP package configuration details, the essential attributes that each Ability must define (such as package name, class name, type, and capabilities provided by Ability), along with the permissions the application needs to access the system or other protected sections of the application. The MainAbility
Indicates the name of HAP package’s entrance ability.[6]Serialization formats
A number of general-purpose
Examples include: JSON, XML, and YAML.
Comparison
Format | Formal specs | Allows comments | Syntax typing[8][9] |
---|---|---|---|
CUE[10] | Yes | Yes | Yes |
INI | No | Yes | No |
JSON | Yes[11] | No | Yes |
TOML | Yes[12] | Yes | Yes |
UCL | No[13] | Yes | Yes |
YAML | Yes[14] | Yes | Yes |
XML | Yes[15] | Yes | No |
See also
- .properties, a file extension mainly used in Java
- HOCON, a superset of .properties and JSON
- INI file, a common configuration file format
- JSON, with support for complex data types and data structures
- Run commands, which explains the historical origin of the "rc" suffix
- TOML, a formally-specified configuration file format
- YAML, with support for complex data types and structures
References
- ^ https://opensource.apple.com/source/postfix/postfix-174.2/Postfix.Config/main.cf.default. Archived 2017-08-03 at the Wayback Machine
- ^ http://opensource.apple.com/source/apache/apache-769/httpd.conf. Archived 2020-08-01 at the Wayback Machine
- ^ "rc file". Catb.org. Retrieved 2012-02-29.
- ^ Microsoft: Windows NT Workstation Resource Kit.
- ^ The OS/2 INI Files by James J. Weinkam.
- ^ Evans, Melissa. "HarmonyOS (Hongmeng) — config.json". Mo4Tech. Mo4Tech. Retrieved 24 March 2024.
- ^ TOML, TOML, 2023-01-15, retrieved 2023-01-15
- ^ Syntax typing refers to the use of syntax to designate data types. In languages that allow syntax typing, type declaration will be syntax-based – e.g.
true
will be a Boolean while"true"
will be a string – whereas in languages that do not allow syntax typing it will be semantics-based – e.g.true
and"true"
will be both recognizable as Booleans, whilemicrowave
and"microwave"
will be both recognizable as strings (this will require the parser to have some prior expectations about the type of a particular field, but this is often the case in configuration files). - ^ Opinions on whether syntax typing in configuration formats is a good or a bad feature vary among authors. with some considering it a disadvantage (see for example What is wrong with TOML § Syntax typing) and others favoring it.
- ^ "About | CUE". Retrieved October 6, 2022.
- ^ "The JavaScript Object Notation (JSON) Data Interchange Format".
- ^ "TOML Specification".
- ^ "Formal UCL grammar definition · Issue #231 · vstakhov/libucl". GitHub.
- ^ "YAML™ Specification Index".
- ^ "Extensible Markup Language (XML) 1.0 (Fifth Edition)".