Skip to content

Config XML

Adrian O'Grady edited this page Nov 25, 2020 · 9 revisions

About

Config.xml can be used to configure Itokawa's settings such as listening port. The config will be used by both the main server application and the cli application.

Location

By default, config.xml can be found in ~/.itokawa/config.xml. If the file doesn't exist, default settings will be used. By using the --datadir PATH command line argument, an alternative directory can be used for loading the config and data.

Example File

<config>
    <application>
        <log>
            <level>INFO</level>
        </log>
    </application>
    <server>
        <port>80</port>
        <publish>
            <ngrok>
                <region>eu</region>
            </ngrok>
        </publish>
    </server>
</config>

Sections

<config><application><commandStation>

Command station configuration. If no explicit configuration is provided, Itokawa will attempt to auto-detect supported command stations and pick the first one found.

Key Values Default Description
retryTime Time in milliseconds 5000 Command station initialisation retry delay if there is an error or no command station found
device Device name undefined Name of command station to use, e.g. WebSocketCommandStation
connectionString String undefined Connection string to pass to command station, e.g. url=ws://itokawa:8080/control/v1

<config><application><log>

Application log configuration.

Key Values Default Description
level DEBUG, INFO, DISPLAY, WARN, ERROR DISPLAY Log output level

<config><client>

Config sections for web UI clients. The settings from this section are made available via the /config route on the server.

<config><debug><serialport>

Enables serial port debug logs if this section is present. Debug snap shots are saved to ~/.itokawa/serialport.snapshot.txt.

Key Values Default Description
snapshotsize 1+ 10 Number of serial port messages to log in the event of an error

<config><featureFlags>

Section for enabling in development and preview features.

Example usage (not real features):

<config>
    <featureFlags>
        <FEATURE_A/>
        <FEATURE_B/>
   </featureFlags>
</config>

<config><server>

Settings for the server application.

Key Values Default Description
port 1-65534 8080 TCP port to listen on

<config><server><admin><password>

Password to enable admin features in the client GUI. If the password hash isn't set, then admin features are available to everyone all the time.

The hash is encoded in the format $scrypt512$cost$salt+hash. Rather than attempting to set this manually, it is recommended that you use the password tool to set it by running npm run password. It will prompt you for a new admin password and set it correctly in the config file.

Example:

<config>
    <server>
        <admin>
<password>$scrypt512$16384$4Xw0SPOXWyRhoWphmqXHFVX+RXkOQFR4SG4pCY1BqjcK00ilgbb6RQK7CXciVPGzcFCdiiqW449z7zwLB75hQEgUFYrLgkDnEjGuk6iTjaKhTA</password>
        </admin>
    </server>
</config>

<config><server><commands>

Shell commands for server operations.

Key Values Default Description
restart Shell command sudo shutdown -r now Command to restart server
shutdown Shell command sudo shutdown -h now Command to shut down server
update Shell command npm run prod-update Command to update Itokawa to the latest version

<config><server><publish><ngrok>

If the ngrok publishing section is present, the server will be publicly accessible using ngrok. Keys are mapped to options as defined on the ngrok npm package docs. The example config would be defined as:

<config>
    <server>
        <publish>
            <ngrok>
                <proto>http</proto>
                <!-- addr>The port is automatically set by Itokawa</addr -->
                <auth>user:pwd</auth>
                <subdomain>alex</subdomain>
                <authtoken>12345</authtoken>
                <region>us</region>
                <configPath>~/git/project/ngrok.yml</configPath>
            </ngrok>
        </publish>
    </server>
</config>