hfs

This file contains details about the configuration files.

Where is it stored

Configuration is stored in the file config.yaml, exception made for custom HTML which is stored in custom.html.

These files are kept in the Current Working Directory (cwd), which is by default the same folder of hfs.exe. if you are using this kind of distribution on Windows, or USER_FOLDER/.hfs on other systems. Many things are stored in the CWD, like the plugins you install. You can decide a different CWD passing --cwd SOME_FOLDER parameter at command line.

If you are not sure what your cwd is, look in the console, and you’ll see that it is printed in one of the first lines. Here is an example, look at the 7th line:

HFS ~ HTTP File Server - Copyright 2021-2023, Massimo Melina <a@rejetto.com>
License https://www.gnu.org/licenses/gpl-3.0.txt
started 10/5/2023, 10:03:23 AM
version 0.49.0
build 2023-10-04T19:46:22.610Z
pid 27302
cwd /Users/rejetto/.hfs
node v18.17.1
config config.yaml

How to modify configuration

Configuration can be done in several ways

NAME stands for the property name that you want to change. See the complete list below.

Configuration properties

Virtual File System (VFS)

The virtual file system is a tree of files and folders, collectively called nodes. By default, a node is a folder, unless you provide for it a source that’s a file. Valid keys in a node are:

Permissions set on an inner element will override inherited permissions. This means that you can restrict access to folder1, and yet decide to give free access to folder1/subfolder2.

Accounts

All accounts go under accounts: property, as a dictionary where the key is the username. E.g.

accounts:
    admin:
        password: hello123
        admin: true
    frank:
        password: another
        belongs: group1
    guest:
        password: guest
    group1:

As soon as the config is read HFS will encrypt passwords (if necessary) in a non-reversible way. It means that password property is replaced with an encrypted property: srp.

As you can see in the example, group1 has no password. This implies that you cannot log in as group1, but still group1 exists and its purpose is to gather multiple accounts and refer to them collectively as group1, so you can quickly share powers among several accounts.

For each account entries, this is the list of properties you can have:

Specify another file

Do you need to load a different config file, even from a different folder? Use this parameter at command line --config PATH or similarly with an env HFS_CONFIG. The path you specify can be either a folder, or full-path to the file.