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

config.enablePolicies = true dose not work on windows #231

Closed
yoieh opened this issue Mar 25, 2020 · 0 comments · Fixed by #232
Closed

config.enablePolicies = true dose not work on windows #231

yoieh opened this issue Mar 25, 2020 · 0 comments · Fixed by #232

Comments

@yoieh
Copy link
Contributor

yoieh commented Mar 25, 2020

Describe the bug
When setting config.enablePolicies = true the policyDirectory is set to the root dir of the project and every file in the project gets loaded as a policy and fails.

To Reproduce
Steps to reproduce the behavior:

  1. on windows spread rest-hapi in to your config and enable enablePolicies
...
const RestHapi = require("rest-hapi");

cosnt config = {
   ...RestHapi.config,
   enablePolicies: true
}
...
  1. add console.log in side of mrhorse lib folder
node_modules\mrhorse\lib\index.js:179
...
197: console.log(policyName, policy)
...
  1. run npm start
  2. See error
....
auditLogTTL null
Error starting server: TypeError: Cannot read property 'applyPoint' of null
    at hasValidApplyPoint ([...]\node_modules\mrhorse\lib\index.js:18:20)
    at addPolicy ([...]\node_modules\mrhorse\lib\index.js:184:10)
    at [...]\node_modules\mrhorse\lib\index.js:226:64
    at [...]\node_modules\lodash\lodash.js:4905:15
    at baseForOwn ([...]\node_modules\lodash\lodash.js:2990:24)
    at [...]\node_modules\lodash\lodash.js:4874:18
    at Function.forEach ([...]\node_modules\lodash\lodash.js:9342:14)
    at loadPolicyFile ([...]\node_modules\mrhorse\lib\index.js:226:23)
    at loadPolicies ([...]\node_modules\mrhorse\lib\index.js:240:9)
    at Object.register ([...]\node_modules\mrhorse\lib\index.js:288:15)
    at internals.Server.register ([...]\node_modules\@hapi\hapi\lib\server.js:466:35)
    at registerMrHorse ([...]\node_modules\rest-hapi\rest-hapi.js:215:16)
    at Object.register ([...]\node_modules\rest-hapi\rest-hapi.js:115:9)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async internals.Server.register ([...]\node_modules\@hapi\hapi\lib\server.js:466:17)
    at async api ([...]\api.js:25:5)

Expected behavior
It should not crash and load my policies

Desktop (please complete the following information):

  • OS: win 10
  • Version: 2.0 but hade the same problem in 1.9.x
  • Nodejs: v12.16.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant