enigma-bbs/docs/filebase/first-file-area.md

102 lines
4.2 KiB
Markdown
Raw Normal View History

---
layout: page
title: Configuring a File Base
---
2018-12-04 23:56:05 +00:00
## Configuring a File Base
2020-05-15 02:58:13 +00:00
ENiGMA½ offers a powerful and flexible file base. Configuration of file the file base and areas is handled via the `fileBase` section of `config.hjson`.
2018-12-04 23:56:05 +00:00
## ENiGMA½ File Base Key Concepts
First, there are some core concepts you should understand:
* Storage Tags
2020-05-15 02:58:13 +00:00
* Area Tags
2018-12-04 23:56:05 +00:00
### Storage Tags
2020-05-15 02:58:13 +00:00
*Storage Tags* define paths to physical (filesystem) storage locations that are referenced in a file *Area* entry. Each entry may be either a fully qualified path or a relative path. Relative paths are relative to the value set by the `fileBase.areaStoragePrefix` key (defaults to `/path/to/enigma-bbs/file_base`).
2018-12-04 23:56:05 +00:00
Below is an example defining some storage tags using the relative and fully qualified forms:
```hjson
storageTags: {
2018-12-04 23:56:05 +00:00
retro_pc_dos: "dos" // relative
retro_pc_bbs: "pc/bbs" // still relative!
bbs_stuff: "/path/to/bbs_stuff_storage" // fully qualified
}
```
2020-11-21 19:35:46 +00:00
:memo: On their own, storage tags don't do anything — they are simply pointers to storage locations on your system.
2020-11-21 19:19:18 +00:00
:warning: Remember that paths are case sensitive on most non-Windows systems!
2018-12-05 01:24:43 +00:00
### Areas
2020-05-15 02:58:13 +00:00
File base *Areas* are configured using the `fileBase.areas` configuration block in `config.hjson`. Each entry's block starts with an *area tag*. Valid members for an area are as follows:
2018-12-04 23:56:05 +00:00
| Item | Required | Description |
|--------|---------------|------------------|
| `name` | :+1: | Friendly area name. |
| `desc` | :-1: | Friendly area description. |
2018-12-04 23:58:21 +00:00
| `storageTags` | :+1: | An array of storage tags for physical storage backing of the files in this area. If uploads are enabled for this area, **first** storage tag location is utilized! |
2018-12-04 23:56:05 +00:00
| `sort` | :-1: | If present, provides the sort key for ordering. `name` is used otherwise. |
| `hashTags` | :-1: | Set to an array of strings or comma separated list to provide _default_ hash tags for this area. |
Example areas section:
```hjson
areas: {
2020-05-15 02:58:13 +00:00
retro_pc: { // an area tag!
name: Retro PC
desc: Oldschool PC/DOS
2018-12-04 23:56:05 +00:00
storageTags: [ "retro_pc_dos", "retro_pc_bbs" ]
hashTags: ["retro", "pc", "dos" ]
}
}
```
2018-12-04 23:56:05 +00:00
The above example defines an area called "Retro PC" which is referenced via the *area tag* of `retro_pc`. Two storage tags are used: `retro_pc_dos`, and `retro_pc_bbs`. These storage tags can be seen in the Storage Tags example above.
## Example Configuration
2018-12-04 23:59:56 +00:00
This combines the two concepts described above. When viewing the file areas from ENiGMA½ a user will only see the "Retro PC" area, but the files in the area are stored in the two locations defined in the `storageTags` section. We also show a uploads area. Uploads are allowed due to the [ACS](acs.md) block. See [Uploads](uploads.md) for more information.
```hjson
fileBase: {
2020-05-15 02:58:13 +00:00
// override the default relative location
areaStoragePrefix: /enigma-bbs/file_base
storageTags: {
2018-12-04 23:56:05 +00:00
retro_pc_dos: "dos"
retro_pc_bbs: "pc/bbs"
}
areas: {
retro_pc: {
2018-04-29 15:13:16 +00:00
name: Retro PC
desc: Oldschool PC/DOS
2018-12-04 23:56:05 +00:00
storageTags: [ "retro_pc_dos", "retro_pc_bbs" ]
}
uploads: {
name: Uploads
desc: User uploads
acs: {
// allow any user to upload here
write: GM[users]
}
storageTags: [ "user_uploads" ]
2018-04-29 15:13:16 +00:00
}
}
}
```
## Importing Areas
2020-11-22 20:53:47 +00:00
Areas can also be imported using [oputil](../admin/oputil.md) using proper FileGate "RAID" aka `FILEBONE.NA` style files. After importing areas, you may wish to tweak configuration such as better `desc` fields, ACS, or sorting.
2019-02-18 21:53:58 +00:00
## Importing Files (Scan For New Files)
2020-11-22 20:53:47 +00:00
A common task is to *import* existing files to area(s). Consider a collection of retro BBS files in the area "Retro PC" (tag: `retro_pc` above) under the storage tag of `retro_pc_bbs`. You might choose to scan for new files in this area (and thus import new entries) as follows with [oputil](../admin/oputil.md)'s `fb scan`:
2019-02-18 21:53:58 +00:00
```bash
./oputil.js fb scan --quick --tags retro,bbs,pc retro_pc@retro_pc_bbs
```
2020-11-22 20:53:47 +00:00
Here we have asked [oputil](../admin/oputil.md) to scan the file base area by it's tag `retro_pc` and only include the storage tag of `retro_pc_bbs`. Note that the storage tag could be omitted, and if so, all of `retro_pc` would be scanned. We have also indicated to #hashtag new entries with the tags "retro", "bbs", and "pc".
2019-02-18 21:57:52 +00:00
2020-11-22 20:53:47 +00:00
Please see [oputil](../admin/oputil.md) for more information.
2019-02-18 21:53:58 +00:00