added support for DOMAIN env var insted of file

This commit is contained in:
mrfry 2023-04-11 10:33:52 +02:00
parent 7d1bddd7e2
commit d310895fcb
9 changed files with 53 additions and 29 deletions

View file

@ -38,17 +38,21 @@ threads, and serve more requests at once. The used cores can be limited with env
Run `./scripts/setup.sh`, then `npm run dev` for development, or `npm run start` for prod.
**Gitlab specific notes**: You need a gitlab account with SSH keys set up in order to be able to use
SSH for cloning this (and any) project. This includes git modules of this project. See
`CLONE_WITH_HTTPS` in environment variables below.
On the first run there will be a number of errors, that some files weren't found. Please create them
according to the messages, these are necessary for the server to function.
There will be also a lot of information about files and other necessary things being created. **Please
read them very carefully, you should know about what was created!**
The setup script can be also used to update and rebuild all git modules.
### Setup notes
* **Gitlab specific notes**: You need a gitlab account with SSH keys set up in order to be able to use
SSH for cloning this (and any) project. This includes git modules of this project. See
`CLONE_WITH_HTTPS` in environment variables below.
* The `DOMAIN` env var can be replaced by making the file `./data/domain`. This is necesarry, to make
xmlhttp requests and some redirects work in statically built HTML files (by next.js), in the
userscript, and in the server itself.
* The setup script can be also used to update and rebuild all git modules.
## Web server paths
@ -63,12 +67,12 @@ server instances, and merge the response data to its own databases.
To setup P2P functionality you have to create a few files in `./data/p2p`:
* `selfInfo.json`: information of this peer. Required:
```
```json
{
"name": "any name you choose",
"contact": "contact to server administrator (irc server, e-mail, anything)",
"host": "server host (like somesite.com, without 'http(s):// and /-s')",
"pw": "password to the host, so the server can log in there",
"pw": "password to the host, so the server can log in there. Please use a dedicated password, that only the server uses!",
"port": "server port, number"
}
```
@ -153,13 +157,14 @@ result can be found in the directory it was ran.
| NS_LOGLEVEL | number | Debug log level, 0 is the least verbose |
| NS_NOLOG | boolean | If logging should be skipped |
| NS_SQL_DEBUG_LOG | boolean | If the SQL queries should be logged |
| DOMAIN | string | The domain that the server should use for redirects, cookies, etc. ex.: `qmining.com`, without 'https://', and '/'-s. If not specified `./data/domain` will be used |
### For the setup script
### For the setup script (`./scripts/setup.sh`)
| Name | Type | Description |
| --- | --- | --- |
| CLONE_WITH_HTTPS | boolean | By default git clones with ssh, which can cause troubles. Set this
to use https for git modules |
| DOMAIN | string | The domain that the server should use for redirects, cookies, etc. ex.: `qmining.com`, without 'https://', and '/'-s. If not specified `./data/domain` will be used |
## npm scripts
@ -209,7 +214,7 @@ https://gitlab.com/MrFry/moodle-test-userscript
│ ├── admins.json forum admins. should be removed and should use admin column from user db
│ ├── apiRootRedirectTo url where domain/api should redirect to
│ ├── dbs/ directory for databases, and for their backups
│ ├── domain the domain the server is hosted on
│ ├── domain the domain the server is hosted on. Used when `DOMAIN` env var is empty
│ ├── f/ user files received TODO: check if this is needed
│ ├── links.json urls for irc, patreon and donate
│ ├── nolog ids of users separated by new lines to ignore on logging