Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude property on ServerSettings doesn't work #713

Closed
striquer opened this issue Nov 28, 2019 · 5 comments
Closed

Exclude property on ServerSettings doesn't work #713

striquer opened this issue Nov 28, 2019 · 5 comments

Comments

@striquer
Copy link

Information

  • Version: 5.34.7
  • Type: Issue

Description

I'm on windows and i need to exclude some Services from the initialization, because i'm splitting the code in two servers, but the exclude property doesn't work for me. I've tried many options, but couldn't figure out why.

Example

@ServerSettings({
    rootDir,
    httpPort: process.env.PORT || 8080,
    httpsPort: false,
    debug: process.env.NODE_ENV === 'production' ? false : false,
    logger: {
        logRequest: process.env.NODE_ENV === 'production' ? false : false,
        requestFields: ["reqId", "method", "url", "headers", "body", "query", "params", "duration"]
    },
    acceptMimes: ["application/json"],
    mount: {
        '/api': '${rootDir}/controllers/**/*.ts',
    },
    componentsScan: [
        '${rootDir}/services/**/*.ts',
        '${rootDir}/models/**/*.ts',
        '${rootDir}/controllers/**/*.ts'
    ],
    exclude: [
        '${rootDir}/servicesQueue/NpcService.ts',
        '${rootDir}/servicesQueue/NpcService.js',
        '${rootDir}/servicesQueue/AgendaService.ts',
        '${rootDir}/servicesQueue/AgendaService.js',
        '${rootDir}/servicesQueue/**/*.ts',
        '${rootDir}/servicesQueue/**/*.js',
        'NpcService.ts',
        'NpcService.js'
    ],
    routers: {
        mergeParams: false,
        strict: true,
        caseSensitive: true
    },
    swagger: [
        {
            path: '/docs',
            spec: {
                securityDefinitions: {
                    Bearer: {
                        type: 'apiKey',
                        name: 'authorization',
                        in: 'header'
                    }
                },
                security: [
                    {
                        Bearer: []
                    }
                ]
            }
        }
    ]
})

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 5.34.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator

Hello @striquer
I'd just published a fix base on the normalize-path module. It should fix the problem on windows. Can you test the new version please ?

See you
Romain

@striquer
Copy link
Author

striquer commented Nov 29, 2019

Hi @Romakita,
It still didn't work for me, it loaded the NpcService on the wrong server again.

This is what the Debug showed:

image

Thanks for the quick update anyway 😊

@Romakita
Copy link
Collaborator

Romakita commented Nov 30, 2019

@striquer Your configuration is a bit strange. Directory servicesQueue isn't listed by componentScan so it cannot be loaded by componentScan excepted if your service is used by another services listed by componentScan or mount options.

Can you check your code ^^

Can you give an access to your project ?

See you
Romain

@striquer
Copy link
Author

Hey @Romakita, you were right, the 5.34.8 solved the problem, after that my mistake is that i was injecting the service that i didn't want on another service included on componentScan. Thanks for the update 😊.

Many Thanks,
Giovanne.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants