mirror of https://github.com/status-im/codimd.git
Remove camel case from `imageuploadtype` in config
This removes the only camel cased option of the config options **we** added to the config.json. In auth provider's config parts are a lot of camel cased options provided. We shouldn't touch them to keep them as similar as possible to the examples. Fixes #315 Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
0138911274
commit
bd92010dd2
|
@ -246,10 +246,10 @@ There are some configs you need to change in the files below
|
||||||
| documentmaxlength | `100000` | note max length |
|
| documentmaxlength | `100000` | note max length |
|
||||||
| email | `true` or `false` | set to allow email signin |
|
| email | `true` or `false` | set to allow email signin |
|
||||||
| allowemailregister | `true` or `false` | set to allow email register (only applied when email is set, default is `true`) |
|
| allowemailregister | `true` or `false` | set to allow email register (only applied when email is set, default is `true`) |
|
||||||
| imageUploadType | `imgur`(default), `s3`, `minio` or `filesystem` | Where to upload image
|
| imageuploadtype | `imgur`(default), `s3`, `minio` or `filesystem` | Where to upload image
|
||||||
| minio | `{ "accessKey": "YOUR_MINIO_ACCESS_KEY", "secretKey": "YOUR_MINIO_SECRET_KEY", "endpoint": "YOUR_MINIO_HOST", port: 9000, secure: true }` | When `imageUploadType` is set to `minio`, you need to set this key. Also checkout our [Minio Image Upload Guide](docs/guides/minio-image-upload.md) |
|
| minio | `{ "accessKey": "YOUR_MINIO_ACCESS_KEY", "secretKey": "YOUR_MINIO_SECRET_KEY", "endpoint": "YOUR_MINIO_HOST", port: 9000, secure: true }` | When `imageuploadtype` is set to `minio`, you need to set this key. Also checkout our [Minio Image Upload Guide](docs/guides/minio-image-upload.md) |
|
||||||
| s3 | `{ "accessKeyId": "YOUR_S3_ACCESS_KEY_ID", "secretAccessKey": "YOUR_S3_ACCESS_KEY", "region": "YOUR_S3_REGION" }` | When `imageUploadType` be set to `s3`, you would also need to setup this key, check our [S3 Image Upload Guide](docs/guides/s3-image-upload.md) |
|
| s3 | `{ "accessKeyId": "YOUR_S3_ACCESS_KEY_ID", "secretAccessKey": "YOUR_S3_ACCESS_KEY", "region": "YOUR_S3_REGION" }` | When `imageuploadtype` be set to `s3`, you would also need to setup this key, check our [S3 Image Upload Guide](docs/guides/s3-image-upload.md) |
|
||||||
| s3bucket | `YOUR_S3_BUCKET_NAME` | bucket name when `imageUploadType` is set to `s3` or `minio` |
|
| s3bucket | `YOUR_S3_BUCKET_NAME` | bucket name when `imageuploadtype` is set to `s3` or `minio` |
|
||||||
|
|
||||||
## Third-party integration api key settings
|
## Third-party integration api key settings
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ Minio Guide for HackMD
|
||||||
8. Set upload type.
|
8. Set upload type.
|
||||||
|
|
||||||
```JSON
|
```JSON
|
||||||
"imageUploadType": "minio"
|
"imageuploadtype": "minio"
|
||||||
```
|
```
|
||||||
|
|
||||||
9. Review your config.
|
9. Review your config.
|
||||||
|
@ -78,6 +78,6 @@ Minio Guide for HackMD
|
||||||
"secure": false
|
"secure": false
|
||||||
},
|
},
|
||||||
"s3bucket": "hackmd",
|
"s3bucket": "hackmd",
|
||||||
"imageUploadType": "minio"
|
"imageuploadtype": "minio"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
{
|
{
|
||||||
"production": {
|
"production": {
|
||||||
...
|
...
|
||||||
"imageUploadType": "s3",
|
"imageuploadtype": "s3",
|
||||||
"s3": {
|
"s3": {
|
||||||
"accessKeyId": "YOUR_S3_ACCESS_KEY_ID",
|
"accessKeyId": "YOUR_S3_ACCESS_KEY_ID",
|
||||||
"secretAccessKey": "YOUR_S3_ACCESS_KEY",
|
"secretAccessKey": "YOUR_S3_ACCESS_KEY",
|
||||||
|
|
|
@ -53,7 +53,9 @@ module.exports = {
|
||||||
// document
|
// document
|
||||||
documentmaxlength: 100000,
|
documentmaxlength: 100000,
|
||||||
// image upload setting, available options are imgur/s3/filesystem
|
// image upload setting, available options are imgur/s3/filesystem
|
||||||
imageUploadType: 'filesystem',
|
imageuploadtype: 'filesystem',
|
||||||
|
// legacy variable name for imageuploadtype
|
||||||
|
imageUploadType: undefined,
|
||||||
imgur: {
|
imgur: {
|
||||||
clientID: undefined
|
clientID: undefined
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,7 +25,7 @@ module.exports = {
|
||||||
allowfreeurl: toBooleanConfig(process.env.HMD_ALLOW_FREEURL),
|
allowfreeurl: toBooleanConfig(process.env.HMD_ALLOW_FREEURL),
|
||||||
defaultpermission: process.env.HMD_DEFAULT_PERMISSION,
|
defaultpermission: process.env.HMD_DEFAULT_PERMISSION,
|
||||||
dburl: process.env.HMD_DB_URL,
|
dburl: process.env.HMD_DB_URL,
|
||||||
imageUploadType: process.env.HMD_IMAGE_UPLOAD_TYPE,
|
imageuploadtype: process.env.HMD_IMAGE_UPLOAD_TYPE,
|
||||||
imgur: {
|
imgur: {
|
||||||
clientID: process.env.HMD_IMGUR_CLIENTID
|
clientID: process.env.HMD_IMGUR_CLIENTID
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,6 +13,7 @@ const debugConfig = {
|
||||||
debug: (env === Environment.development)
|
debug: (env === Environment.development)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get version string from package.json
|
||||||
const {version} = require(path.join(appRootPath, 'package.json'))
|
const {version} = require(path.join(appRootPath, 'package.json'))
|
||||||
|
|
||||||
const packageConfig = {
|
const packageConfig = {
|
||||||
|
@ -20,7 +21,7 @@ const packageConfig = {
|
||||||
minimumCompatibleVersion: '0.5.0'
|
minimumCompatibleVersion: '0.5.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
const configFilePath = path.join(__dirname, '../../config.json')
|
const configFilePath = path.join(appRootPath, 'config.json')
|
||||||
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
|
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
|
||||||
|
|
||||||
let config = require('./default')
|
let config = require('./default')
|
||||||
|
@ -97,8 +98,13 @@ config.isLDAPEnable = config.ldap.url
|
||||||
config.isSAMLEnable = config.saml.idpSsoUrl
|
config.isSAMLEnable = config.saml.idpSsoUrl
|
||||||
config.isPDFExportEnable = config.allowpdfexport
|
config.isPDFExportEnable = config.allowpdfexport
|
||||||
|
|
||||||
|
// merge legacy values
|
||||||
|
if (config.imageUploadType && !config.imageuploadtype) {
|
||||||
|
config.imageuploadtype = config.imageUploadType
|
||||||
|
}
|
||||||
|
|
||||||
// figure out mime types for image uploads
|
// figure out mime types for image uploads
|
||||||
switch (config.imageUploadType) {
|
switch (config.imageuploadtype) {
|
||||||
case 'imgur':
|
case 'imgur':
|
||||||
config.allowedUploadMimeTypes = [
|
config.allowedUploadMimeTypes = [
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
|
|
|
@ -19,7 +19,7 @@ imageRouter.post('/uploadimage', function (req, res) {
|
||||||
|
|
||||||
form.keepExtensions = true
|
form.keepExtensions = true
|
||||||
|
|
||||||
if (config.imageUploadType === 'filesystem') {
|
if (config.imageuploadtype === 'filesystem') {
|
||||||
form.uploadDir = 'public/uploads'
|
form.uploadDir = 'public/uploads'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ imageRouter.post('/uploadimage', function (req, res) {
|
||||||
if (config.debug) { logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image)) }
|
if (config.debug) { logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image)) }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (config.imageUploadType) {
|
switch (config.imageuploadtype) {
|
||||||
case 'filesystem':
|
case 'filesystem':
|
||||||
res.send({
|
res.send({
|
||||||
link: url.resolve(config.serverurl + '/', files.image.path.match(/^public\/(.+$)/)[1])
|
link: url.resolve(config.serverurl + '/', files.image.path.match(/^public\/(.+$)/)[1])
|
||||||
|
|
Loading…
Reference in New Issue