add basic uci docs
[web.git] / docs / uci.txt
1 include::header.txt[]
2
3 == UCI - Unified Configuration Interface
4
5 _LEDE_ uses UCI to store its configuration. This is a human readable file format using typed and named section. Each section contains a number of options. Options can be single values or list of values. All configuration files are stored in the /etc/config/ folder. You can manually edit these files.
6
7 ----
8 root@lede:/# cat etc/config/system
9 config system
10 option hostname lede
11 option timezone UTC
12
13 config timeserver ntp
14 list server 0.openwrt.pool.ntp.org
15 list server 1.openwrt.pool.ntp.org
16 list server 2.openwrt.pool.ntp.org
17 list server 3.openwrt.pool.ntp.org
18 option enabled 1
19 option enable_server 0
20 ----
21
22 Alternatively you may use the uci CLI to read/modify their content. Using the CLI has the advantage that you do not need to worry about the validity of the syntax. Some user do however prefer to make changes manually, they should however be aware that even minor syntax errors will make the whole file unparsable and not just the specific section and/or option that was modified.
23
24 ----
25 root@lede:/# uci show system
26 system.@system[0]=system
27 system.@system[0].hostname='lede'
28 system.@system[0].timezone='UTC'
29 system.ntp=timeserver
30 system.ntp.server='0.openwrt.pool.ntp.org' '1.openwrt.pool.ntp.org' '2.openwrt.pool.ntp.org' '3.openwrt.pool.ntp.org'
31 system.ntp.enabled='1'
32 system.ntp.enable_server='0'
33 ----
34
35 When using the CLI to modify values, you will find that all changes first get staged and not commited to the file directly. If you want to permanently store changes you need to commit them. After calling the commit command, you can also make the system reload and apply the changes that you made
36
37 ----
38 root@lede:/# uci set system.@system[0].hostname=foo
39 root@lede:/# uci commit
40 root@lede:/# reload_config
41 root@lede:/#
42 root@foo:/#
43 ----