Skip to content

Commit

Permalink
default strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hmt committed Apr 28, 2021
1 parent 03d5bef commit f20c6ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Then create a `servers.json` file like this here:

Now you are ready to start the script with setting a port and a secret:

TINYSCALE_SECRET=some_secret_string deno run --allow-net --allow-read --allow-env https://deno.land/x/tinyscale@v1.4.0/mod.ts
TINYSCALE_SECRET=some_secret_string deno run --allow-net --allow-read --allow-env https://deno.land/x/tinyscale@v1.5.0/mod.ts

tinyscales then runs on port 3005 and you will have to set up your reverse proxy so that it can pick up requests or you leave it on that port. If you prefer a different port you can set one with another env-var: `PORT 3006`
tinyscale then runs on port 3005 and you will have to set up your reverse proxy so that it can pick up requests or you leave it on that port. If you prefer a different port you can set one with another env var: `PORT 3006`

When started, tinyscale will connect to each server and make a single call to check if your configuration is correct. If there is a problem tinyscale will abort. If your configuration works you can start using it in your environment by replacing your existing BBB settings with the new tinyscale url in your third party apps. Make sure to also replace the BBB secrets with your new `TINYSCALE_SECRET`.

If you set the additional env var `TINYSCALE_STRICT=true` you can have tinyscale only switch servers when called with a `create`. This may result in better server handling (ymmv).
If you set the additional env var `TINYSCALE_STRICT=false` tinyscale will switch servers with every call to a room that doesn't exist. This might result in a more random distribution of room creations (ymmv).

tinyscale has been tested to work with NextCloud, Moodle and Greenlight.

Expand Down
11 changes: 6 additions & 5 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import { opine, ErrorRequestHandler, Router, createHash, server, createError, Co
import { BBB } from './bbb.ts';

const date = () => new Date().toLocaleTimeString('de')
const VERSION = 'v1.4.0'
const tinyscale_strict: boolean = Deno.env.get("TINYSCALE_STRICT") === 'true'|| '1' ? true : false
console.log(date() + Color.green(` Starting tinyscale ${VERSION} in ${tinyscale_strict ? 'strict':'loose'} mode`))
const VERSION = 'v1.5.0'
// give your tinyscale server a secret so it looks like a BBB server
const secret = Deno.env.get("TINYSCALE_SECRET") || ""
const secret: string = Deno.env.get("TINYSCALE_SECRET") || ""
if (!secret) throw "No secret set for tinyscale"
const tinyscale_strict: boolean = Deno.env.get("TINYSCALE_STRICT") === 'false' ? false : true
console.log(date() + Color.green(` Starting tinyscale ${VERSION} in ${tinyscale_strict ? 'strict':'loose'} mode`))
console.log(`Your secret is set to ${Color.green(secret)}`)

// store your BBB servers in servers.json
const file: string = await Deno.readTextFile('servers.json')
const servers: server[] = JSON.parse(file)
// create an iterator so that we can treat all servers equally
let iterator = servers[Symbol.iterator]();
console.log(servers)
console.log('Checking servers first …')
console.log(servers)
// check servers for connectivity and if the secret is correct
servers.forEach(async s => {
const hash = createHash("sha1");
Expand Down

0 comments on commit f20c6ab

Please sign in to comment.