feature(config) default path: ~/.cloudcmd.json

This commit is contained in:
coderaiser 2014-10-17 02:37:42 -04:00
parent 46f283fb4e
commit 1f7a41ced1
2 changed files with 38 additions and 43 deletions

66
HELP.md
View file

@ -181,7 +181,7 @@ For more details see [Jq-console keyboard shortcuts](https://github.com/replit/j
Config
---------------
![Console](/img/screen/config.png "Config")
![Config](/img/screen/config.png "Config")
###Hot keys
|Key |Operation
@ -189,6 +189,31 @@ Config
| `F10` | open
| `Esc` | close
When you change one of options file `~/.cloudcmd.json` would be saved.
It could be edited manually with any text editor.
Here is description of options:
```js
{
"auth" : false, /* enable http authentication */
"username" : "root", /* username for authentication */
"password" : "toor", /* password hash in sha-1 for authentication*/
"analytics" : true, /* google analytics support */
"diff" : true, /* when save - send patch, not whole file */
"zip" : true, /* zip text before send / unzip before save */
"notifications" : false, /* show notifications when tab is not active*/
"localStorage" : true, /* cache directory data */
"buffer" : true, /* buffer for copying files */
"dirStorage" : true, /* store directory listing to localStorage */
"minify" : true, /* minification of js,css,html and img */
"online" : true, /* load js files from cdn or local path */
"cache" : true, /* add cache-control */
"showKeysPanel" : true, /* show classic panel with buttons of keys */
"server" : true, /* server mode or testing mode */
"port" : 8000, /* http port */
"ip" : null, /* ip or null(default) */
}
Menu
---------------
![Menu](/img/screen/menu.png "Menu")
@ -215,45 +240,6 @@ Right mouse click button shows context menu with items:
| `F9` | open
| `Esc` | close
Configuration
---------------
All main configuration could be done via `json/config.json`.
```js
{
"auth" : false, /* enable http authentication */
"username" : "root", /* username for authentication */
"password" : "toor", /* password hash in sha-1 for authentication*/
"analytics" : true, /* google analytics support */
"diff" : true, /* when save - send patch, not whole file */
"zip" : true, /* zip text before send / unzip before save */
"notifications" : false, /* show notifications when tab is not active*/
"localStorage" : true, /* cache directory data */
"buffer" : true, /* buffer for copying files */
"dirStorage" : true, /* store directory listing to localStorage */
"minify" : true, /* minification of js,css,html and img */
"online" : true, /* load js files from cdn or local path */
"cache" : true, /* add cache-control */
"showKeysPanel" : true, /* show classic panel with buttons of keys */
"server" : true, /* server mode or testing mode */
"port" : 8000, /* http port */
"ip" : null, /* ip or null(default) */
}
```
If you had changed **config** and want to keep updating via git,
you should execute next command in root directory of **Cloud Commander**:
```
git update-index --assume-unchanged json/config.json
```
To get back to tracking:
```
git update-index --no-assume-unchanged json/config.json
```
Server
---------------
Standard practices say no non-root process gets to talk to

View file

@ -5,14 +5,23 @@
DIR_LIB = DIR_SERVER + '../',
DIR = DIR_SERVER + '../../',
HOME_WIN = process.env.HOMEPATH,
HOME_UNIX = process.env.HOME,
HOME = (HOME_UNIX || HOME_WIN) + '/',
fs = require('fs'),
Util = require(DIR_LIB + 'util'),
tryRequire = require(DIR_SERVER + 'tryRequire'),
ConfigPath = DIR + 'json/config.json',
ConfigPath = DIR + 'json/config.json',
ConfigHome = HOME + '.cloudcmd.json',
config = tryRequire(ConfigPath, {log: true}) || {};
config =
tryRequire(ConfigHome) ||
tryRequire(ConfigPath, {log: true}) || {};
module.exports = function(key, value) {
var result;
@ -31,7 +40,7 @@
Util.checkArgs(arguments, ['callback']);
if (data)
fs.writeFile(ConfigPath, data, callback);
fs.writeFile(ConfigHome, data, callback);
else
callback({
message: 'Error: config is empty!'