Skip to content

Commit

Permalink
fix(config): remise à plat des valeurs par défaut
Browse files Browse the repository at this point in the history
  • Loading branch information
thom4parisot committed Oct 21, 2024
1 parent f863601 commit 3c20381
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 43 deletions.
18 changes: 10 additions & 8 deletions export/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,34 @@ convict.addFormat(require('convict-format-with-validator').url)
*/
module.exports = convict({
port: {
default: 3060,
format: 'port',
env: 'PORT'
env: 'PORT',
default: 3060
},
api: {
urlEndpoint: {
default: 'http://localhost:3030/graphql',
format: 'url',
env: 'SNOWPACK_PUBLIC_GRAPHQL_ENDPOINT'
env: 'SNOWPACK_PUBLIC_GRAPHQL_ENDPOINT',
default: 'http://localhost:3030/graphql'
},
passthroughToken: {
format: 'string',
sensitive: true,
env: 'SE_GRAPHQL_TOKEN'
env: 'SE_GRAPHQL_TOKEN',
default: null
}
},
export: {
// legacy option
canonicalBaseUrl: {
format: 'url',
env: 'EXPORT_CANONICAL_BASE_URL'
env: 'EXPORT_CANONICAL_BASE_URL',
default: 'http://127.0.0.1:3060'
},
urlEndpoint: {
default: 'http://127.0.0.1:3080',
format: 'url',
env: 'SNOWPACK_PUBLIC_PANDOC_EXPORT_ENDPOINT'
env: 'SNOWPACK_PUBLIC_PANDOC_EXPORT_ENDPOINT',
default: 'http://127.0.0.1:3080'
}
}
})
76 changes: 41 additions & 35 deletions graphql/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,60 @@ module.exports = convict({
export: {
baseUrl: {
format: 'url',
env: 'EXPORT_CANONICAL_BASE_URL'
env: 'EXPORT_CANONICAL_BASE_URL',
default: 'http://127.0.0.1:3060'
},
urlEndpoint: {
default: 'http://127.0.0.1:3080',
format: 'url',
env: 'SNOWPACK_PUBLIC_PANDOC_EXPORT_ENDPOINT'
env: 'SNOWPACK_PUBLIC_PANDOC_EXPORT_ENDPOINT',
default: 'http://127.0.0.1:3080'
}
},
mongo: {
db: {
default: 'stylo-dev',
format: String,
env: 'MONGO_SERVER_DB'
env: 'MONGO_SERVER_DB',
default: 'stylo-dev'
},
host: {
default: '127.0.0.1',
format: String,
env: 'MONGO_SERVER'
env: 'MONGO_SERVER',
default: '127.0.0.1'
},
port: {
default: '27027',
format: 'port',
env: 'MONGO_SERVER_PORT'
env: 'MONGO_SERVER_PORT',
default: '27027'
}
},
oauthProvider: {
name: {
default: '',
format: String,
env: 'OPENID_CONNECT_NAME'
env: 'OPENID_CONNECT_NAME',
default: null,
},
issuer: {
default: '',
format: 'url',
env: 'OPENID_CONNECT_ISSUER'
env: 'OPENID_CONNECT_ISSUER',
default: null,
},
callbackUrl: {
default: '',
format: 'url',
env: 'OPENID_CONNECT_CALLBACK_URL'
env: 'OPENID_CONNECT_CALLBACK_URL',
default: 'http://localhost:3000/authorization-code/callback'
},
client: {
id: {
default: '',
format: String,
sensitive: true,
env: 'OPENID_CONNECT_CLIENT_ID'
env: 'OPENID_CONNECT_CLIENT_ID',
default: null
},
secret: {
default: '',
format: String,
sensitive: true,
env: 'OPENID_CONNECT_CLIENT_SECRET'
env: 'OPENID_CONNECT_CLIENT_SECRET',
default: null
}
},
scope: {
Expand All @@ -75,24 +76,24 @@ module.exports = convict({
tokenUrl: {
format: 'url',
env: 'OPENID_CONNECT_TOKEN_URL',
default: '',
default: null,
},
userInfo: {
format: 'url',
env: 'OPENID_CONNECT_USER_INFO_URL',
default: '',
default: null,
},
url: {
format: 'url',
env: 'OPENID_CONNECT_AUTH_URL',
default: ''
default: null
}
}
},
port: {
default: 3030,
format: 'port',
env: 'PORT'
env: 'PORT',
default: 3030
},
securedCookie: {
format: Boolean,
Expand All @@ -111,47 +112,52 @@ module.exports = convict({
secret: {
format: String,
sensitive: true,
env: 'JWT_SECRET_SESSION_COOKIE'
env: 'JWT_SECRET_SESSION_COOKIE',
default: null,
}
},
session: {
secret: {
format: String,
sensitive: true,
env: 'SESSION_SECRET'
env: 'SESSION_SECRET',
default: null
}
}
},
zotero: {
accessPoint: {
default: 'https://www.zotero.org/oauth/access',
format: 'url',
env: 'ZOTERO_ACCESS_TOKEN_ENDPOINT'
env: 'ZOTERO_ACCESS_TOKEN_ENDPOINT',
default: 'https://www.zotero.org/oauth/access'
},
authorize: {
default: 'https://www.zotero.org/oauth/authorize',
format: 'url',
env: 'ZOTERO_AUTHORIZE_ENDPOINT'
env: 'ZOTERO_AUTHORIZE_ENDPOINT',
default: 'https://www.zotero.org/oauth/authorize'
},
requestToken: {
default: 'https://www.zotero.org/oauth/request',
format: 'url',
env: 'ZOTERO_REQUEST_TOKEN_ENDPOINT'
env: 'ZOTERO_REQUEST_TOKEN_ENDPOINT',
default: 'https://www.zotero.org/oauth/request'
},
auth: {
callbackUrl: {
format: 'url',
env: 'ZOTERO_AUTH_CALLBACK_URL'
env: 'ZOTERO_AUTH_CALLBACK_URL',
default: 'http://localhost:3030/authorization-code/zotero/callback'
},
clientKey: {
format: String,
sensitive: true,
env: 'ZOTERO_AUTH_CLIENT_KEY'
env: 'ZOTERO_AUTH_CLIENT_KEY',
default: null
},
clientSecret: {
format: String,
sensitive: true,
env: 'ZOTERO_AUTH_CLIENT_SECRET'
env: 'ZOTERO_AUTH_CLIENT_SECRET',
default: null
}
}
}
Expand Down

0 comments on commit 3c20381

Please sign in to comment.