Extract config.js from common.js to make client setting file clean and also make upgrade easier
This commit is contained in:
parent
917537ddbf
commit
bf4c6d021c
9 changed files with 21 additions and 17 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -19,5 +19,5 @@ backups/
|
|||
|
||||
# ignore config files
|
||||
config.json
|
||||
public/js/common.js
|
||||
public/js/config.js
|
||||
.sequelizerc
|
||||
|
|
|
@ -83,10 +83,10 @@ There are some configs you need to change in the files below
|
|||
|
||||
```
|
||||
./config.json --- for server settings
|
||||
./public/js/common.js --- for client settings
|
||||
./public/js/config.js --- for client settings
|
||||
```
|
||||
|
||||
Client settings `common.js`
|
||||
Client settings `config.js`
|
||||
---
|
||||
|
||||
| variables | example values | description |
|
||||
|
@ -148,7 +148,7 @@ Third-party integration api key settings
|
|||
| ------- | --------- | ----------- |
|
||||
| facebook, twitter, github, gitlab, dropbox, google | `config.json` | for signin |
|
||||
| imgur | `config.json` | for image upload |
|
||||
| google drive, dropbox | `public/js/common.js` | for export and import |
|
||||
| google drive, dropbox | `public/js/config.js` | for export and import |
|
||||
|
||||
Third-party integration oauth callback urls
|
||||
---
|
||||
|
|
|
@ -25,8 +25,8 @@ if [ ! -f config.json ]; then
|
|||
cp config.json.example config.json
|
||||
fi
|
||||
|
||||
if [ ! -f publis/js/common.js ]; then
|
||||
cp public/js/common.js.example public/js/common.js
|
||||
if [ ! -f publis/js/config.js ]; then
|
||||
cp public/js/config.js.example public/js/config.js
|
||||
fi
|
||||
|
||||
if [ ! -f .sequelizerc ]; then
|
||||
|
@ -43,7 +43,7 @@ Edit the following config file to setup hackmd server and client.
|
|||
Read more info at https://github.com/hackmdio/hackmd#configuration-files
|
||||
|
||||
* config.json -- server config
|
||||
* public/js/common.js -- client config
|
||||
* public/js/config.js -- client config
|
||||
* .sequelizerc -- db config
|
||||
|
||||
EOF
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
//common
|
||||
var domain = ''; // domain name
|
||||
var urlpath = ''; // sub url path, like: www.example.com/<urlpath>
|
||||
//settings
|
||||
var debug = false;
|
||||
|
||||
var GOOGLE_API_KEY = '';
|
||||
var GOOGLE_CLIENT_ID = '';
|
||||
|
||||
var DROPBOX_APP_KEY = '';
|
||||
|
||||
var port = window.location.port;
|
||||
var serverurl = window.location.protocol + '//' + (domain ? domain : window.location.hostname) + (port ? ':' + port : '') + (urlpath ? '/' + urlpath : '');
|
||||
var noteid = urlpath ? window.location.pathname.slice(urlpath.length + 1, window.location.pathname.length).split('/')[1] : window.location.pathname.split('/')[1];
|
10
public/js/config.js.example
Normal file
10
public/js/config.js.example
Normal file
|
@ -0,0 +1,10 @@
|
|||
//config
|
||||
var domain = ''; // domain name
|
||||
var urlpath = ''; // sub url path, like: www.example.com/<urlpath>
|
||||
//settings
|
||||
var debug = false;
|
||||
|
||||
var GOOGLE_API_KEY = '';
|
||||
var GOOGLE_CLIENT_ID = '';
|
||||
|
||||
var DROPBOX_APP_KEY = '';
|
|
@ -75,6 +75,7 @@
|
|||
<script src="<%- url %>/vendor/keymaster/keymaster.js" defer></script>
|
||||
<script src="<%- url %>/js/google-drive-upload.js" defer></script>
|
||||
<script src="<%- url %>/js/google-drive-picker.js" defer></script>
|
||||
<script src="<%- url %>/js/config.js" defer></script>
|
||||
<script src="<%- url %>/js/common.js" defer></script>
|
||||
<script src="<%- url %>/js/extra.js" defer></script>
|
||||
<script src="<%- url %>/js/render.js" defer></script>
|
||||
|
|
|
@ -205,6 +205,7 @@
|
|||
<script src="<%- url %>/vendor/file-saver/FileSaver.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/store-js/store.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/lz-string/libs/lz-string.min.js" defer></script>
|
||||
<script src="<%- url %>/js/config.js" defer></script>
|
||||
<script src="<%- url %>/js/common.js" defer></script>
|
||||
<script src="<%- url %>/js/history.js" defer></script>
|
||||
<script src="<%- url %>/js/cover.js" defer></script>
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
<script src="<%- url %>/vendor/viz.js/viz.js" defer></script>
|
||||
<script src="<%- url %>/vendor/pdfobject/pdfobject.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/md-toc.js" defer></script>
|
||||
<script src="<%- url %>/js/config.js" defer></script>
|
||||
<script src="<%- url %>/js/common.js" defer></script>
|
||||
<script src="<%- url %>/js/extra.js" defer></script>
|
||||
<script src="<%- url %>/js/render.js" defer></script>
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
<script src="<%- url %>/vendor/viz.js/viz.js" defer></script>
|
||||
<script src="<%- url %>/vendor/pdfobject/pdfobject.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/md-toc.js" defer></script>
|
||||
<script src="<%- url %>/js/config.js" defer></script>
|
||||
<script src="<%- url %>/js/common.js" defer></script>
|
||||
<script src="<%- url %>/js/extra.js" defer></script>
|
||||
<script src="<%- url %>/js/render.js" defer></script>
|
||||
|
|
Loading…
Reference in a new issue