Add config option to turn server side rendering off.
Ensure templates are precompiled before starting the server.merge-requests/27/head
parent
4ec89d71f8
commit
961b5fe648
|
@ -15,11 +15,13 @@ Follow the instructions after setup runs.
|
||||||
```bash
|
```bash
|
||||||
npm run start
|
npm run start
|
||||||
```
|
```
|
||||||
You can also run this to skip checking the database version on startup.
|
You can also skip checking the database version and compiling templates (if you don't use server-side rendering) on startup.
|
||||||
```bash
|
```bash
|
||||||
npm run start -- --skip-migrate
|
npm run start -- --skip-migrate --skip-compile
|
||||||
# don't forget to migrate manually when you update
|
# don't forget to migrate manually when you update
|
||||||
npm run migrate
|
npm run migrate
|
||||||
|
# and compile templates after any changes
|
||||||
|
npm run make-templates
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
|
@ -14,6 +14,7 @@ rtmp:
|
||||||
http:
|
http:
|
||||||
# uncomment to set HSTS when SSL is ready
|
# uncomment to set HSTS when SSL is ready
|
||||||
#hsts: true
|
#hsts: true
|
||||||
|
server_side_render: false
|
||||||
|
|
||||||
database:
|
database:
|
||||||
user: '<dbuser>'
|
user: '<dbuser>'
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import * as db from "./database";
|
import * as db from "./database";
|
||||||
import {readdirSync} from "fs";
|
import {readdirSync} from "fs";
|
||||||
|
import { execSync } from "child_process";
|
||||||
|
|
||||||
async function init(m?: boolean) {
|
async function init() {
|
||||||
if(!m){
|
if(process.argv.indexOf('--skip-migrate') === -1){
|
||||||
console.log('Checking database version.');
|
console.log('Checking database version.');
|
||||||
var tmp: string[] = await db.query('show tables like \"db_meta\"');
|
var tmp: string[] = await db.query('show tables like \"db_meta\"');
|
||||||
if(tmp.length === 0){
|
if(tmp.length === 0){
|
||||||
|
@ -17,6 +18,15 @@ async function init(m?: boolean) {
|
||||||
else {
|
else {
|
||||||
console.log('Skipping database version check.');
|
console.log('Skipping database version check.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!require('./config').config['http']['server_side_render'] && process.argv.indexOf('--skip-compile') === -1) {
|
||||||
|
console.log("Compiling templates for client-side frontend.");
|
||||||
|
execSync(process.cwd()+'/node_modules/.bin/nunjucks-precompile -i [\"\\.html$\",\"\\.njk$\"] templates > site/templates.js');
|
||||||
|
}
|
||||||
|
else if(!require('./config').config['http']['server_side_render']){
|
||||||
|
console.log("Skipped compiling templates for client-side frontend.");
|
||||||
|
}
|
||||||
|
|
||||||
//If satyr is restarted in the middle of a stream
|
//If satyr is restarted in the middle of a stream
|
||||||
//it causes problems
|
//it causes problems
|
||||||
//Live flags in the database stay live
|
//Live flags in the database stay live
|
||||||
|
|
|
@ -36,7 +36,10 @@ const config: Object = {
|
||||||
ping: 30,
|
ping: 30,
|
||||||
ping_timeout: 60 }, localconfig['rtmp']),
|
ping_timeout: 60 }, localconfig['rtmp']),
|
||||||
http: Object.assign({
|
http: Object.assign({
|
||||||
hsts: false, directory: './site', port: 8000
|
hsts: false,
|
||||||
|
directory: './site',
|
||||||
|
port: 8000,
|
||||||
|
server_side_render: true
|
||||||
}, localconfig['http']),
|
}, localconfig['http']),
|
||||||
media: Object.assign({
|
media: Object.assign({
|
||||||
record: false,
|
record: false,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { config } from "./config";
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
await initDB();
|
await initDB();
|
||||||
await clean(process.argv.indexOf('--skip-migrate') !== -1);
|
await clean();
|
||||||
await initHTTP();
|
await initHTTP();
|
||||||
await initRTMP();
|
await initRTMP();
|
||||||
await initChat();
|
await initChat();
|
||||||
|
|
Reference in New Issue