Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
8b89c2bb
Commit
8b89c2bb
authored
May 15, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: config env vars parser + heroku config file
parent
59ce39f0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
36 deletions
+23
-36
config.heroku.yml
npm/configs/config.heroku.yml
+12
-12
install.js
npm/install.js
+7
-7
configure.js
server/configure.js
+2
-2
config.js
server/helpers/config.js
+1
-1
init.js
server/init.js
+1
-14
No files found.
npm/configs/config.heroku.yml
View file @
8b89c2bb
...
...
@@ -8,13 +8,13 @@
# Title of this site
# ---------------------------------------------------------------------
title
:
Wiki
title
:
$(WIKI_TITLE)
# ---------------------------------------------------------------------
# Full public path to the site, without the trailing slash
# ---------------------------------------------------------------------
host
:
https://YOURAPP.herokuapp.com/
host
:
$(WIKI_HOST)
# ---------------------------------------------------------------------
# Port the main server should listen to (80 by default)
...
...
@@ -44,13 +44,13 @@ uploads:
# ---------------------------------------------------------------------
# Possible values: en, de, es, fr, ko, pt or ru
lang
:
en
lang
:
$(WIKI_LANG)
# ---------------------------------------------------------------------
# Site Authentication
# ---------------------------------------------------------------------
public
:
false
public
:
$(WIKI_PUBLIC)
auth
:
defaultReadAccess
:
false
...
...
@@ -97,7 +97,7 @@ auth:
# ---------------------------------------------------------------------
# Use a long and unique random string (256-bit keys are perfect!)
sessionSecret
:
1234567890abcdefghijklmnopqrstuvxyz
sessionSecret
:
$(WIKI_SESSION_KEY)
# ---------------------------------------------------------------------
# Database Connection String
...
...
@@ -110,16 +110,16 @@ db: $(MONGODB_URI)
# ---------------------------------------------------------------------
git
:
url
:
https://github.com/Organization/Repo
branch
:
master
url
:
$(WIKI_GIT_URL)
branch
:
$(WIKI_GIT_BRANCH)
auth
:
# Type: basic or ssh
type
:
ssh
type
:
basic
# Only for Basic authentication:
username
:
marty
password
:
MartyMcFly88
username
:
$(WIKI_GIT_USERNAME)
password
:
$(WIKI_GIT_PASSWORD)
# Only for SSH authentication:
privateKey
:
/etc/wiki/keys/git.pem
...
...
@@ -127,10 +127,10 @@ git:
sslVerify
:
true
# Default email to use as commit author
serverEmail
:
marty@example.com
serverEmail
:
$(WIKI_SERVER_EMAIL)
# Whether to use user email as author in commits
showUserEmail
:
true
showUserEmail
:
$(WIKI_SHOW_USER_EMAIL)
# ---------------------------------------------------------------------
# Features
...
...
npm/install.js
View file @
8b89c2bb
...
...
@@ -137,7 +137,7 @@ const tasks = {
if
(
err
.
code
===
'ENOENT'
)
{
ora
.
text
=
'First-time install, creating a new config.yml...'
let
sourceConfigFile
=
path
.
join
(
installDir
,
'config.sample.yml'
)
if
(
process
.
env
.
I
S_HEROKU
)
{
if
(
process
.
env
.
WIKI_J
S_HEROKU
)
{
sourceConfigFile
=
path
.
join
(
__dirname
,
'configs/config.heroku.yml'
)
}
else
if
(
process
.
env
.
WIKI_JS_DOCKER
)
{
sourceConfigFile
=
path
.
join
(
__dirname
,
'configs/config.docker.yml'
)
...
...
@@ -152,7 +152,11 @@ const tasks = {
})
},
startConfigurationWizard
()
{
if
(
process
.
stdout
.
isTTY
&&
!
process
.
env
.
WIKI_JS_DOCKER
)
{
if
(
process
.
env
.
WIKI_JS_HEROKU
)
{
console
.
info
(
'Wiki.js has been installed and is configured to use Heroku configuration.'
)
}
else
if
(
process
.
env
.
WIKI_JS_DOCKER
)
{
console
.
info
(
'Docker environment detected. Skipping setup wizard auto-start.'
)
}
else
if
(
process
.
stdout
.
isTTY
)
{
inquirer
.
prompt
([{
type
:
'list'
,
name
:
'action'
,
...
...
@@ -202,11 +206,7 @@ const tasks = {
})
})
}
else
{
if
(
!
process
.
env
.
IS_HEROKU
&&
!
process
.
env
.
WIKI_JS_DOCKER
)
{
console
.
info
(
colors
.
cyan
(
'[WARNING] Non-interactive terminal detected. You must manually start the configuration wizard using the command: node wiki configure'
))
}
else
{
console
.
info
(
'Container environment detected. Skipping setup wizard auto-start. OK.'
)
}
}
}
}
...
...
@@ -224,7 +224,7 @@ if (!process.env.IS_HEROKU && !process.env.WIKI_JS_DOCKER) {
'
\\
/
\\
/ |_|_|
\\
_
\\
_(_)/ |___/
\
n'
+
' |__/
\
n'
))
}
else
{
console
.
info
(
'
=-=-= WIKI.JS =-=-=
'
)
console
.
info
(
'
> WIKI.JS [Installing...]
'
)
}
let
ora
=
require
(
'ora'
)({
text
:
'Initializing...'
,
spinner
:
'dots12'
}).
start
()
...
...
server/configure.js
View file @
8b89c2bb
...
...
@@ -67,8 +67,8 @@ module.exports = (port, spinner) => {
langs
,
conf
,
runmode
:
{
staticPort
:
(
process
.
env
.
I
S_HEROKU
||
process
.
env
.
WIKI_JS_DOCKER
),
staticMongo
:
(
!
_
.
isNil
(
process
.
env
.
I
S_HEROKU
))
staticPort
:
(
process
.
env
.
WIKI_J
S_HEROKU
||
process
.
env
.
WIKI_JS_DOCKER
),
staticMongo
:
(
!
_
.
isNil
(
process
.
env
.
WIKI_J
S_HEROKU
))
}
})
})
...
...
server/helpers/config.js
View file @
8b89c2bb
...
...
@@ -13,7 +13,7 @@ module.exports = {
return
_
.
replace
(
cfg
,
(
/
\$\(([
A-Z0-9_
]
+
)\)
/g
,
(
m
)
=>
{
return
process
.
env
[
m
]
})
(
fm
,
m
)
=>
{
return
process
.
env
[
m
]
})
)
}
}
server/init.js
View file @
8b89c2bb
...
...
@@ -13,7 +13,7 @@ module.exports = {
* Detect the most appropriate start mode
*/
startDetect
:
function
()
{
if
(
process
.
env
.
I
S_HEROKU
)
{
if
(
process
.
env
.
WIKI_J
S_HEROKU
)
{
return
this
.
startInHerokuMode
()
}
else
{
return
this
.
startInBackgroundMode
()
...
...
@@ -49,21 +49,8 @@ module.exports = {
* Start in Heroku mode
*/
startInHerokuMode
:
function
()
{
let
self
=
this
console
.
info
(
'Initializing Wiki.js for Heroku...'
)
let
herokuStatePath
=
path
.
join
(
__dirname
,
'./app/heroku.json'
)
return
fs
.
accessAsync
(
herokuStatePath
).
then
(()
=>
{
require
(
'./server.js'
)
}).
catch
(
err
=>
{
if
(
err
.
code
===
'ENOENT'
)
{
console
.
info
(
'Wiki.js is not configured yet. Launching configuration wizard...'
)
self
.
configure
(
process
.
env
.
PORT
)
}
else
{
console
.
error
(
err
)
process
.
exit
(
1
)
}
})
},
/**
* Stop Wiki.js process(es)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment