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 { Controller } from './Controller'
|
||||||
export { Database } from './Database'
|
|
||||||
export { Storage } from './Storage'
|
export { Storage } from './Storage'
|
@ -1,9 +1,9 @@
|
|||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
|
|
||||||
function fetchController(key) {
|
function fetchController(key, from) {
|
||||||
try {
|
try {
|
||||||
const controllersPath = global.controllersPath ?? path.resolve(process.cwd(), `controllers`)
|
const controllersPath = from ?? path.resolve(process.cwd(), `controllers`)
|
||||||
const controllerPath = path.join(controllersPath, key)
|
const controllerPath = path.join(controllersPath, key)
|
||||||
|
|
||||||
if (fs.existsSync(controllerPath)) {
|
if (fs.existsSync(controllerPath)) {
|
||||||
|
@ -213,7 +213,7 @@ class Server {
|
|||||||
if (typeof this.controllers[endpoint.controller] !== "undefined") {
|
if (typeof this.controllers[endpoint.controller] !== "undefined") {
|
||||||
endpoint.controller = this.controllers[endpoint.controller]
|
endpoint.controller = this.controllers[endpoint.controller]
|
||||||
} else {
|
} else {
|
||||||
endpoint.controller = fetchController(endpoint.controller)
|
endpoint.controller = fetchController(endpoint.controller, this.params.controllersPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user