Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hub
overleaf
Commits
a038b56d
Commit
a038b56d
authored
Mar 04, 2014
by
Oliver Matthews
Browse files
refactor config settings.
parent
f85178bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Gruntfile.coffee
View file @
a038b56d
...
...
@@ -104,9 +104,11 @@ module.exports = (grunt) ->
Helpers
.
checkLatexmk
@
async
()
grunt
.
registerTask
"check:s3"
,
"Check that Amazon S3 credentials are configured"
,
()
->
Helpers
.
checkS3
@
async
()
grunt
.
registerTask
"check:fs"
,
"Check that local filesystem options are configured"
,
()
->
Helpers
.
checkFS
@
async
()
grunt
.
registerTask
"check:make"
,
"Check that make is installed"
,
()
->
Helpers
.
checkMake
@
async
()
grunt
.
registerTask
"check"
,
"Check that you have the required dependencies installed"
,
[
"check:redis"
,
"check:latexmk"
,
"check:s3"
]
grunt
.
registerTask
"check"
,
"Check that you have the required dependencies installed"
,
[
"check:redis"
,
"check:latexmk"
,
"check:s3"
,
"check:fs"
]
Helpers
=
installService
:
(
repo_src
,
dir
,
callback
=
(
error
)
->
)
->
...
...
@@ -222,38 +224,63 @@ module.exports = (grunt) ->
callback
(
error
)
checkS3
:
(
callback
=
(
error
)
->
)
->
grunt
.
log
.
write
"Checking S3 credentials... "
Settings
=
require
"settings-sharelatex"
try
client
=
knox
.
createClient
({
key
:
Settings
.
s3
.
key
secret
:
Settings
.
s3
.
secret
bucket
:
Settings
.
s3
.
buckets
.
user_files
})
catch
e
grunt
.
log
.
error
"FAIL."
grunt
.
log
.
errorlns
"""
Please configure you Amazon S3 credentials in config/settings.development.coffee
Amazon S3 (Simple Storage Service) is a cloud storage service provided by
Amazon. ShareLaTeX uses S3 for storing binary files like images. You can
sign up for an account and find out more at:
http://aws.amazon.com/s3/
"""
return
callback
()
client
.
getFile
"does-not-exist"
,
(
error
,
response
)
->
unless
response
?
and
response
.
statusCode
==
404
if
Settings
.
filestore
.
backend
==
""
grunt
.
log
.
writeln
"No backend specified. Assuming Amazon S3"
Settings
.
filestore
.
backend
=
"s3"
if
Settings
.
filestore
.
backend
==
"s3"
grunt
.
log
.
write
"Checking S3 credentials... "
try
client
=
knox
.
createClient
({
key
:
Settings
.
filestore
.
s3
.
key
secret
:
Settings
.
filestore
.
s3
.
secret
bucket
:
Settings
.
filestore
.
stores
.
user_files
})
catch
e
grunt
.
log
.
error
"FAIL."
grunt
.
log
.
errorlns
"""
Could not connect to Amazon S3. Please check your credentials.
Please configure you Amazon S3 credentials in config/settings.development.coffee
Amazon S3 (Simple Storage Service) is a cloud storage service provided by
Amazon. ShareLaTeX uses S3 for storing binary files like images. You can
sign up for an account and find out more at:
http://aws.amazon.com/s3/
"""
else
grunt
.
log
.
write
"OK."
return
callback
()
client
.
getFile
"does-not-exist"
,
(
error
,
response
)
->
unless
response
?
and
response
.
statusCode
==
404
grunt
.
log
.
error
"FAIL."
grunt
.
log
.
errorlns
"""
Could not connect to Amazon S3. Please check your credentials.
"""
else
grunt
.
log
.
write
"OK."
callback
()
else
grunt
.
log
.
writeln
"Filestore other than S3 configured. Not checking S3."
callback
()
checkFS
:
(
callback
=
(
error
)
->
)
->
Settings
=
require
"settings-sharelatex"
if
Settings
.
filestore
.
backend
==
"fs"
grunt
.
log
.
write
"Checking FS configuration..."
fs
=
require
(
"fs"
)
fs
.
exists
Settings
.
filestore
.
stores
.
user_files
,
(
exists
)
->
if
exists
grunt
.
log
.
write
"OK."
else
grunt
.
log
.
error
"FAIL."
grunt
.
log
.
errorlns
"""
Could not find directory "
#{
Settings
.
filestore
.
stores
.
user_files
}
".
Please check your configuration.
"""
else
grunt
.
log
.
writeln
"Filestore other than FS configured. Not checking FS."
callback
()
checkMake
:
(
callback
=
(
error
)
->
)
->
grunt
.
log
.
write
"Checking make is installed... "
exec
"make --version"
,
(
error
,
stdout
,
stderr
)
->
...
...
config/settings.development.coffee.example
View file @
a038b56d
...
...
@@ -19,17 +19,31 @@ module.exports =
# File storage
# ------------
#
# ShareLaTeX stores binary files like images in S3.
# Fill in your Amazon S3 credentials below.
s3:
key: ""
secret: ""
buckets:
# The S3 bucket name to store binary files in
user_files: ""
# ShareLaTeX needs somewhere to store binary files like images.
# There are currently two options:
# Amazon S3 (the default)
# local filesystem
# Tell the filestore api to use s3 to persist files, in future more backends can be added
filestoreBackend: "s3"
filestore:
# which backend persistor to use.
# choices are
# s3 - Amazon S3
# fs - local filesystem
backend: "s3"
stores:
# where to store user and template binary files
#
# For Amazon S3 this is the bucket name to store binary files in
# Must contain full url like: <bucketname>.s3.amazonaws.com
#
# For local filesystem this is the directory to store the files in.
# Must contain full path, e.g. "/var/lib/sharelatex/data"
# This path must exist, not be tmpfs and be writable to by the user sharelatex is run as.
user_files: ""
s3:
# if you are using S3, then fill in your S3 details below
key: ""
secret: ""
# Databases
# ---------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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