Commit 272533fc authored by Leo Iannacone's avatar Leo Iannacone

auto export user configuration on npm install

parent 08e83618
*/node_modules */node_modules
debomatic-webui/public/external_libs */*/external_libs
*/user.config.js
\ No newline at end of file
var config = {} /*
* Please DO NOT edit this file.
*
* Edit auto-generated "user.config.js" file instead.
*
*/
config.version = '0.1-b1' // #start config-auto-export
var config = {}
config.host = 'localhost' config.host = 'localhost'
config.port = 3000 config.port = 3000
config.user = 'www-data' // who will run server config.user = 'www-data' // who will run server [not fully tested yet]
config.debomatic = {} config.debomatic = {}
config.debomatic.path = '/srv/debomatic-amd64' config.debomatic.path = '/srv/debomatic-amd64'
...@@ -37,7 +43,12 @@ config.web.preferences.file_background = true ...@@ -37,7 +43,12 @@ config.web.preferences.file_background = true
config.web.preferences.file_fontsize = 13 // valid values are [13..16] config.web.preferences.file_fontsize = 13 // valid values are [13..16]
config.web.preferences.debug = 0 // debug level - 0 means disabled config.web.preferences.debug = 0 // debug level - 0 means disabled
// DO NOT EDIT these ones // #end config-auto-export
// DO NOT TOUCH these ones
config.version = '0.1-b1'
// A simple function to quickly have // A simple function to quickly have
// get and set strings for client events // get and set strings for client events
......
...@@ -4,3 +4,5 @@ export SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ...@@ -4,3 +4,5 @@ export SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash ${SCRIPTS_DIR}/install/remove_css_directory_listing.sh bash ${SCRIPTS_DIR}/install/remove_css_directory_listing.sh
bash ${SCRIPTS_DIR}/install/download_external_libs.sh bash ${SCRIPTS_DIR}/install/download_external_libs.sh
python ${SCRIPTS_DIR}/install/create-user-config.py
\ No newline at end of file
#!/usr/bin/python
# create a user.config.js file starting from lib/config.js
import os
base_path = os.environ['SCRIPTS_DIR']
global_config_file = os.path.join(base_path, '../lib/config.js')
user_config_file = os.path.join(base_path, '../user.config.js')
if os.path.isfile(user_config_file):
print ("A config user file already exists. Skipping creation.")
print user_config_file
exit()
export_header = """
/*
* debomatic-webui user configuration
*/
"""
export_config = []
with open(global_config_file) as fd:
start = False
for line in fd:
if line.find('#start config-auto-export') >= 0:
start = True
continue
elif line.find('#end config-auto-export') >= 0:
break
if start:
export_config.append(line)
export_config.append('// DO NOT EDIT THIS LINE:\n')
export_config.append('module.exports = config')
print ("Creating user configuration ...")
with open(user_config_file, 'w') as fd:
fd.write(export_header)
fd.write(''.join(export_config))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment