Skip to content

Commit

Permalink
new start server script based on js
Browse files Browse the repository at this point in the history
use js for cross-platform startup.
  • Loading branch information
miRoox committed Jun 9, 2024
1 parent 0efece8 commit 016a588
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"private": true,
"scripts": {
"build": "tiddlywiki --build index && mv output/index.html .",
"start": "bash start.sh",
"start": "node start.js",
"test": "npm run build"
},
"repository": {
Expand Down
26 changes: 26 additions & 0 deletions start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

const tiddlywiki = require("tiddlywiki");

const tw = tiddlywiki.TiddlyWiki();

const host = process.env.HOST
const port = process.env.WIKIPORT ?? '7777'
const password = process.env.WIKIPW

const argv = ['--listen']

if (host) {
argv.push('host='+host)
}
argv.push('port='+port)
if (password) {
argv.push('username=miRoox', 'password='+password)
}
argv.push('readers=(anon)', 'writers=(authenticated)', 'admin=miRoox')

console.debug('arg: %o', argv)

tw.boot.argv = argv

tw.boot.boot();
10 changes: 0 additions & 10 deletions start.sh

This file was deleted.

0 comments on commit 016a588

Please sign in to comment.