mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-09 08:25:00 -04:00
replace settings.json with settings.yml
This commit is contained in:
parent
9617ace809
commit
1e14b310bf
9 changed files with 89 additions and 106 deletions
|
@ -41,20 +41,6 @@ if [ ! $NODE_V_MINOR = "v0.8" ] && [ ! $NODE_V_MINOR = "v0.6" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
#Get the name of the settings file
|
||||
settings="settings.json"
|
||||
a='';
|
||||
for arg in $*; do
|
||||
if [ "$a" = "--settings" ] || [ "$a" = "-s" ]; then settings=$arg; fi
|
||||
a=$arg
|
||||
done
|
||||
|
||||
#Does a $settings exist? if no copy the template
|
||||
if [ ! -f $settings ]; then
|
||||
echo "Copy the settings template to $settings..."
|
||||
cp -v settings.json.template $settings || exit 1
|
||||
fi
|
||||
|
||||
echo "Ensure that all dependencies are up to date..."
|
||||
(
|
||||
mkdir -p node_modules
|
||||
|
|
|
@ -30,9 +30,5 @@ echo _
|
|||
echo Clearing cache.
|
||||
del /S var\minified*
|
||||
|
||||
echo _
|
||||
echo Setting up settings.json...
|
||||
IF NOT EXIST settings.json copy settings.json.template settings.json
|
||||
|
||||
echo _
|
||||
echo Installed Etherpad-lite!
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
This file must be valid JSON. But comments are allowed
|
||||
|
||||
Please edit settings.json, not settings.json.template
|
||||
*/
|
||||
{
|
||||
//Ip and port which etherpad should bind at
|
||||
"ip": "0.0.0.0",
|
||||
"port" : 9001,
|
||||
|
||||
//The Type of the database. You can choose between dirty, postgres, sqlite and mysql
|
||||
//You shouldn't use "dirty" for for anything else than testing or development
|
||||
"dbType" : "dirty",
|
||||
//the database specific settings
|
||||
"dbSettings" : {
|
||||
"filename" : "var/dirty.db"
|
||||
},
|
||||
|
||||
/* An Example of MySQL Configuration
|
||||
"dbType" : "mysql",
|
||||
"dbSettings" : {
|
||||
"user" : "root",
|
||||
"host" : "localhost",
|
||||
"password": "",
|
||||
"database": "store"
|
||||
},
|
||||
*/
|
||||
|
||||
//the default text of a pad
|
||||
"defaultPadText" : "Welcome to Etherpad Lite!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nEtherpad Lite on Github: http:\/\/j.mp/ep-lite\n",
|
||||
|
||||
/* Users must have a session to access pads. This effectively allows only group pads to be accessed. */
|
||||
"requireSession" : false,
|
||||
|
||||
/* Users may edit pads but not create new ones. Pad creation is only via the API. This applies both to group pads and regular pads. */
|
||||
"editOnly" : false,
|
||||
|
||||
/* if true, all css & js will be minified before sending to the client. This will improve the loading performance massivly,
|
||||
but makes it impossible to debug the javascript/css */
|
||||
"minify" : true,
|
||||
|
||||
/* How long may clients use served javascript code (in seconds)? Without versioning this
|
||||
may cause problems during deployment. Set to 0 to disable caching */
|
||||
"maxAge" : 21600, // 60 * 60 * 6 = 6 hours
|
||||
|
||||
/* This is the path to the Abiword executable. Setting it to null, disables abiword.
|
||||
Abiword is needed to enable the import/export of pads*/
|
||||
"abiword" : null,
|
||||
|
||||
/* This setting is used if you require authentication of all users.
|
||||
Note: /admin always requires authentication. */
|
||||
"requireAuthentication": false,
|
||||
|
||||
/* Require authorization by a module, or a user with is_admin set, see below. */
|
||||
"requireAuthorization": false,
|
||||
|
||||
/* Users for basic authentication. is_admin = true gives access to /admin.
|
||||
If you do not uncomment this, /admin will not be available! */
|
||||
/*
|
||||
"users": {
|
||||
"admin": {
|
||||
"password": "changeme1",
|
||||
"is_admin": true
|
||||
},
|
||||
"user": {
|
||||
"password": "changeme1",
|
||||
"is_admin": false
|
||||
}
|
||||
},
|
||||
*/
|
||||
|
||||
/* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
|
||||
"loglevel": "INFO"
|
||||
}
|
77
settings.yml.example
Normal file
77
settings.yml.example
Normal file
|
@ -0,0 +1,77 @@
|
|||
---
|
||||
#Ip and port which etherpad should bind at
|
||||
|
||||
ip : 0.0.0.0
|
||||
port : 9001
|
||||
|
||||
|
||||
#The Type of the database. You can choose between dirty, postgres, sqlite and mysql
|
||||
#You shouldn't use "dirty" for for anything else than testing or development
|
||||
dbType : dirty
|
||||
|
||||
|
||||
#the database specific settings
|
||||
dbSettings :
|
||||
filename : var/dirty.db
|
||||
|
||||
|
||||
# An Example of MySQL Configuration
|
||||
# dbType" : "mysql"
|
||||
# dbSettings" :
|
||||
# user : root
|
||||
# host : localhost
|
||||
# password :
|
||||
# database : store
|
||||
|
||||
|
||||
#the default text of a pad
|
||||
defaultPadText : |
|
||||
Welcome to Etherpad Lite!
|
||||
This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!
|
||||
|
||||
Etherpad Lite on Github: http://j.mp/ep-lite
|
||||
|
||||
# Users must have a session to access pads. This effectively allows only group pads to be accessed.
|
||||
requireSession : false
|
||||
|
||||
# Users may edit pads but not create new ones. Pad creation is only via the API. This applies both to group pads and regular pads.
|
||||
editOnly : false
|
||||
|
||||
|
||||
# if true, all css & js will be minified before sending to the client. This will improve the loading performance massivly,
|
||||
# but makes it impossible to debug the javascript/css
|
||||
minify : true
|
||||
|
||||
|
||||
# How long may clients use served javascript code (in seconds)? Without versioning this
|
||||
# may cause problems during deployment. Set to 0 to disable caching
|
||||
# 60 * 60 * 6 = 6 hours
|
||||
maxAge : 21600
|
||||
|
||||
# This is the path to the Abiword executable. Setting it to null, disables abiword.
|
||||
# Abiword is needed to enable the import/export of pads
|
||||
abiword : null
|
||||
|
||||
|
||||
# This setting is used if you require authentication of all users.
|
||||
# Note: /admin always requires authentication.
|
||||
requireAuthentication : false
|
||||
|
||||
|
||||
# Require authorization by a module, or a user with is_admin set, see below.
|
||||
requireAuthorization : false
|
||||
|
||||
|
||||
# Users for basic authentication. is_admin = true gives access to /admin.
|
||||
# If you do not uncomment this, /admin will not be available!
|
||||
|
||||
# users:
|
||||
# admin: {
|
||||
# password : changeme1,
|
||||
# is_admin : true
|
||||
# user :
|
||||
# password : changeme1,
|
||||
# is_admin : false
|
||||
|
||||
# The log level we are using, can be: DEBUG, INFO, WARN, ERROR
|
||||
loglevel : INFO
|
|
@ -36,7 +36,7 @@ exports.createServer = function () {
|
|||
console.log("The plugin admin page is at http://" + settings.ip + ":" + settings.port + "/admin/plugins");
|
||||
}
|
||||
else{
|
||||
console.warn("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json");
|
||||
console.warn("Admin username and password not set in settings.yml. To access admin please uncomment and edit 'users' in settings.yml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
|||
//if abiword is disabled, and this is a format we only support with abiword, output a message
|
||||
if (settings.abiword == null &&
|
||||
["odt", "pdf", "doc"].indexOf(req.params.type) !== -1) {
|
||||
res.send("Abiword is not enabled at this Etherpad Lite instance. Set the path to Abiword in settings.json to enable this feature");
|
||||
res.send("Abiword is not enabled at this Etherpad Lite instance. Set the path to Abiword in settings.yml to enable this feature");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ var arg, prevArg;
|
|||
for ( var i = 0; i < argv.length; i++ ) {
|
||||
arg = argv[i];
|
||||
|
||||
// Override location of settings.json file
|
||||
// Override location of settings.yml file
|
||||
if ( prevArg == '--settings' || prevArg == '-s' ) {
|
||||
exports.argv.settings = arg;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* The Settings Modul reads the settings out of settings.json and provides
|
||||
* The Settings Modul reads the settings out of settings.yml and provides
|
||||
* this information to the other modules
|
||||
*/
|
||||
|
||||
|
@ -24,6 +24,7 @@ var os = require("os");
|
|||
var path = require('path');
|
||||
var argv = require('./Cli').argv;
|
||||
var npm = require("npm/lib/npm.js");
|
||||
var yaml = require('js-yaml');
|
||||
|
||||
/* Root path of the installation */
|
||||
exports.root = path.normalize(path.join(npm.dir, ".."));
|
||||
|
@ -101,7 +102,7 @@ exports.abiwordAvailable = function()
|
|||
}
|
||||
|
||||
// Discover where the settings file lives
|
||||
var settingsFilename = argv.settings || "settings.json";
|
||||
var settingsFilename = argv.settings || "settings.yml";
|
||||
if (settingsFilename.charAt(0) != '/') {
|
||||
settingsFilename = path.normalize(path.join(root, settingsFilename));
|
||||
}
|
||||
|
@ -111,22 +112,18 @@ try{
|
|||
//read the settings sync
|
||||
settingsStr = fs.readFileSync(settingsFilename).toString();
|
||||
} catch(e){
|
||||
console.warn('No settings file found. Using defaults.');
|
||||
settingsStr = '{}';
|
||||
console.error('No settings file found. If you were using a settings.json file, cosider converting it using \'./bin/settings2yml settings.json > settings.yml\'');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
//remove all comments
|
||||
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");
|
||||
|
||||
//try to parse the settings
|
||||
var settings;
|
||||
try
|
||||
{
|
||||
settings = JSON.parse(settingsStr);
|
||||
settings = yaml.load(settingsStr);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error("There is a syntax error in your settings.json file");
|
||||
console.error("There is a syntax error in your settings.ym file");
|
||||
console.error(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
"graceful-fs" : "1.1.5",
|
||||
"slide" : "1.1.3",
|
||||
"semver" : "1.0.13",
|
||||
"underscore" : "1.3.1"
|
||||
"underscore" : "1.3.1",
|
||||
"js-yaml" : "1.x"
|
||||
},
|
||||
"bin": { "etherpad-lite": "./node/server.js" },
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue