diff --git a/.gitignore b/.gitignore
index 3e18fdc..2970374 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+/config.run.yml
+
# Logs
logs
*.log
diff --git a/Dockerfile b/Dockerfile
index 49c92b2..5c0470e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:11 as base
+FROM node:12 as base
# Create app directory
RUN mkdir -p /opt/app
@@ -19,7 +19,7 @@ RUN npm run build
# Final image
#####################
-FROM node:11-alpine
+FROM node:12-alpine
ENV NODE_ENV=prod
MAINTAINER cracker0dks
@@ -28,7 +28,7 @@ MAINTAINER cracker0dks
RUN mkdir -p /opt/app
WORKDIR /opt/app
-COPY ./package.json ./package-lock.json ./
+COPY ./package.json ./package-lock.json config.default.yml ./
RUN npm ci --only=prod
COPY scripts ./scripts
diff --git a/README.md b/README.md
index 0759645..3054515 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,10 @@ This is a lightweight NodeJS collaborative Whiteboard/Sketchboard witch can easi
[HERE](https://cloud13.de/testwhiteboard/) (Reset every night)
+## Updating
+
+Information related to updating this app can be found [here](./doc/updating_guide.md).
+
## Some Features
- Shows remote user cursors while drawing
@@ -34,7 +38,7 @@ You can run this app with and without docker
### Without Docker
-1. install the latest NodeJs
+1. install the latest NodeJs (version >= 12)
2. Clone the app
3. Run `npm ci` inside the folder
4. Run `npm run start:prod`
@@ -108,13 +112,26 @@ Call your site with GET parameters to change the WhiteboardID or the Username
- title => Change the name of the Browser Tab
- randomid => if set to true, a random whiteboardId will be generated if not given aswell
-## Security - AccessToken (Optional)
+## Configuration
-To prevent clients who might know or guess the base URL from abusing the server to upload files and stuff..., you can set an accesstoken at server start.
+Many settings of this project can be set using a simple `yaml` file, to change some behaviors or tweak performances.
-Server (Without docker): `node scripts/server.js --accesstoken="mySecToken"`
+### Config. file
-Server (With docker): `docker run -d -p 8080:8080 rofl256/whiteboard --accesstoken="mySecToken"`
+To run the project with custom settings:
+
+1. Create a `config.run.yml` file based on the content of [`config.default.yml`](./config.default.yml),
+2. Change the settings,
+3. Run the project with your custom configuration (it will be merged into the default one):
+
+- locally: `node scripts/server.js --config=./config.run.yml`
+- docker: `docker run -d -p 8080:8080 -v $(pwd)/config.run.yml:/config.run.yml:ro rofl256/whiteboard --config=/config.run.yml`
+
+### Highlights
+
+#### Security - AccessToken (Optional)
+
+To prevent clients who might know or guess the base URL from abusing the server to upload files and stuff..., you can set an accesstoken at server start (see [here](./config.default.yml)).
Then set the same token on the client side as well:
@@ -122,15 +139,11 @@ Then set the same token on the client side as well:
Done!
-## WebDAV (Optional)
+#### WebDAV (Optional)
This function allows your users to save the whiteboard directly to a webdav server (Nextcloud) as image without downloading it.
-To enable it:
-
-Server (Without docker): `node scripts/server.js --webdav=true`
-
-Server (With docker): `docker run -d -p 8080:8080 rofl256/whiteboard --webdav=true`
+To enable set `enableWebdav` to `true` in the [configuration](./config.default.yml).
Then set the same parameter on the client side as well:
@@ -142,17 +155,15 @@ Note: For the most owncloud/nextcloud setups you have to set the WebDav-Server U
Done!
+### And many more (performance, etc.)
+
+Many more settings can be tweaked. All of them are described in the [default config file](./config.default.yml).
+
## Things you may want to know
- Whiteboards are gone if you restart the Server, so keep that in mind (or save your whiteboard)
- You should be able to customize the layout without ever touching the whiteboard.js (take a look at index.html & main.js)
-## All server start parameters (also docker)
-
-- accesstoken => take a look at "Security - AccessToken" for a full explanation
-- disablesmallestscreen => set this to "true" if you don't want show the "smallest screen" indicator (A dotted gray line) to the users
-- webdav => Enable the function to save to a webdav-server (Must also be enabled on the client; Take a look at the webdav section)
-
## ToDo
- Make undo function more reliable on texts
diff --git a/config.default.yml b/config.default.yml
index 9b6688b..2ac3912 100644
--- a/config.default.yml
+++ b/config.default.yml
@@ -3,7 +3,7 @@ backend:
# Access token required for interacting with the server -- string (empty string for no restrictions)
accessToken: ""
- # Is webdav saving enabled -- boolean
+ # Enable the function to save to a webdav-server (check README for more info) -- boolean
enableWebdav: false
# Backend performance tweaks
diff --git a/doc/updating_guide.md b/doc/updating_guide.md
new file mode 100644
index 0000000..4e3fe6c
--- /dev/null
+++ b/doc/updating_guide.md
@@ -0,0 +1,13 @@
+# Updating guide
+
+## From v1.x to 2.x (or latest)
+
+Configuration handling has been updated: the ability to change settings from the CLI or the environment has been removed.
+
+**Configuration is now handled with a yml config file**, which can be overridden with the `--config` CLI argument.
+
+Here is the mapping from old cli argument / env variables to the new config file object:
+
+- accesstoken => `backend.accessToken`
+- webdav => `backend.enableWebdav`
+- disablesmallestscreen => `frontend.showSmallestScreenIndicator`
diff --git a/docker-compose.yml b/docker-compose.yml
index 878bd00..c156505 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -5,5 +5,4 @@ services:
restart: always
ports:
- "8080:8080/tcp"
- environment:
- - ACCESSTOKEN=mysecrettoken
+ command: --config=./config.default.yml