-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rackover
committed
Feb 4, 2020
1 parent
cda8259
commit 738d5a4
Showing
9 changed files
with
119 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const path = require("path"); | ||
const fs = require("fs") | ||
|
||
let contents = {}; | ||
const contentsDirName = WIKI_CONTENTS_DIRECTORY_NAME; | ||
const units = ["css", "favicon", "header", "background"]; | ||
|
||
module.exports = function(){ | ||
updateContents(); | ||
|
||
setInterval(updateContents, process.env.WIKI_CONTENT_UPDATE_INTERVAL * 60 * 1000); | ||
|
||
return function(){return contents;}() | ||
}() | ||
|
||
function updateContents(){ | ||
logger.debug("Updating contents...") | ||
contents = { | ||
"css": "/style.css", | ||
"favicon": "/res/img/favicon.png", | ||
"header": false, | ||
"background": false | ||
} | ||
|
||
for (k in units){ | ||
const v = units[k] | ||
const dirPath = path.join(WIKI_PATH, contentsDirName, v); | ||
if (fs.existsSync(dirPath)){ | ||
const files = fs.readdirSync(dirPath) | ||
if (files.length > 0){ | ||
contents[v] = path.join(dirPath, files[0]).replace(WIKI_PATH, "") | ||
logger.debug("Found custom content for "+v+"! ("+files[0]+")") | ||
continue | ||
} | ||
} | ||
} | ||
|
||
logger.debug("Done!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
module.exports = function(env){ | ||
cEnv = process.env; | ||
cEnv = {}; | ||
defaultEnv = require("./defaultenv.js"); | ||
cEnv.DEBUG_LEVEL = env.debuglvl || process.env.DEBUG_LEVEL || defaultEnv.DEBUG_LEVEL | ||
cEnv.PORT = env.port || process.env.PORT || defaultEnv.PORT | ||
cEnv.LOG_PORT = env.logport || process.env.LOG_PORT || defaultEnv.LOG_PORT | ||
cEnv.PORT = parseInt(env.port || process.env.PORT || defaultEnv.PORT) | ||
cEnv.LOG_PORT = parseInt(env.logport || process.env.LOG_PORT || defaultEnv.LOG_PORT) | ||
cEnv.GIT_PEM_FILE = env.pemfile || process.env.GIT_PEM_FILE || defaultEnv.GIT_PEM_FILE | ||
cEnv.GIT_REPO_URL = env.repo || process.env.GIT_REPO_URL || defaultEnv.GIT_REPO_URL | ||
cEnv.GIT_REPO_BRANCH = env.branch || process.env.GIT_REPO_BRANCH || defaultEnv.GIT_REPO_BRANCH | ||
cEnv.GIT_PULL_INTERVAL = parseInt(process.env.GIT_PULL_INTERVAL || defaultEnv.GIT_PULL_INTERVAL) | ||
cEnv.GIT_PUSH_INTERVAL = parseInt(process.env.GIT_PUSH_INTERVAL || defaultEnv.GIT_PUSH_INTERVAL) | ||
cEnv.WIKI_PATH = env.wikipath || process.env.WIKI_PATH || defaultEnv.WIKI_PATH | ||
cEnv.GIT_PUSH_INTERVAL = process.env.GIT_PUSH_INTERVAL || defaultEnv.GIT_PUSH_INTERVAL | ||
cEnv.WIKI_CONTENT_UPDATE_INTERVAL = parseInt(process.env.WIKI_CONTENT_UPDATE_INTERVAL || defaultEnv.WIKI_CONTENT_UPDATE_INTERVAL) | ||
return cEnv; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node app.js run |