mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
allow load controller from
This commit is contained in:
parent
0ee8455ae9
commit
fdd221f8a7
@ -1,5 +0,0 @@
|
||||
class Authorization {
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Authorization }
|
@ -1,5 +0,0 @@
|
||||
class Database {
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Database }
|
@ -1,4 +1,2 @@
|
||||
export { Authorization } from './Authorization'
|
||||
export { Controller } from './Controller'
|
||||
export { Database } from './Database'
|
||||
export { Storage } from './Storage'
|
@ -1,9 +1,9 @@
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
|
||||
function fetchController(key) {
|
||||
function fetchController(key, from) {
|
||||
try {
|
||||
const controllersPath = global.controllersPath ?? path.resolve(process.cwd(), `controllers`)
|
||||
const controllersPath = from ?? path.resolve(process.cwd(), `controllers`)
|
||||
const controllerPath = path.join(controllersPath, key)
|
||||
|
||||
if (fs.existsSync(controllerPath)) {
|
||||
|
@ -213,7 +213,7 @@ class Server {
|
||||
if (typeof this.controllers[endpoint.controller] !== "undefined") {
|
||||
endpoint.controller = this.controllers[endpoint.controller]
|
||||
} else {
|
||||
endpoint.controller = fetchController(endpoint.controller)
|
||||
endpoint.controller = fetchController(endpoint.controller, this.params.controllersPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user