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

127 customize gateway from bosconfigjson #147

Merged
merged 17 commits into from
Aug 6, 2024

Conversation

bb-face
Copy link
Collaborator

@bb-face bb-face commented Aug 2, 2024

Resolves #127

@bb-face bb-face linked an issue Aug 2, 2024 that may be closed by this pull request
7 tasks
@bb-face bb-face requested a review from elliotBraem August 2, 2024 13:57
lib/dev.ts Outdated Show resolved Hide resolved
lib/server.ts Outdated Show resolved Hide resolved
lib/dev.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
lib/config.ts Outdated Show resolved Hide resolved
lib/dev.ts Outdated Show resolved Hide resolved
lib/dev.ts Outdated

gatewayObject.enabled = commandGateway;

if (configGateway?.bundleUrl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering we have a default config, ability to override this config, or --no-gateway to disable it, I'm not entirely sure what this function does anymore. Take a step back and reassess it's purpose and if it's clearer to just check if gateway is disabled or not

Although we do need error checking -- we can't have bundleUrl without tagName and can't have tagName without bundleUrl

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and let's have a test to confirm both must be populated)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error checking is in config.ts in the configuration schema, if I try to run the app without a gateway with both tagName and bundleUrl it will return this error:

(node:20505) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✗ SyntaxError: bos.config.json: Expected double-quoted property name in JSON at position 421 (line 14 column 2)
    at JSON.parse (<anonymous>)
    at _readFile (/Users/stefano/Workspace/Work/NEAR/bos-workspace/node_modules/jsonfile/index.js:25:16)

Without the option -g the logic is simpler but still needs to be expressed somewhere, that's the purpose of that function, somehow we need to specify the logic of the gateway: if it's disabled, if it's enabled but without a configuration object in bos.config.json or if it's enabled with a correctly formatted configuration object!

Let me know if you want to introduce more error checking on top of the Joi schema or if I need to move the gateway logic somewhere else!

lib/server.ts Outdated Show resolved Hide resolved
lib/server.ts Outdated Show resolved Hide resolved
lib/server.ts Outdated Show resolved Hide resolved
tests/unit/gateway.ts Show resolved Hide resolved
tests/unit/server.ts Outdated Show resolved Hide resolved
@elliotBraem
Copy link
Contributor

@race-of-sloths include

@race-of-sloths
Copy link

race-of-sloths commented Aug 2, 2024

@bb-face Thank you for your contribution! Your pull request is now a part of the Race of Sloths!

Shows profile picture for the author of the PR

Current status: executed
Reviewer Score
@elliotBraem 5

Your contribution is much appreciated with a final score of 5!
You have received 70 (50 base + 20 weekly bonus) Sloth points for this contribution

Another weekly streak completed, well done @bb-face! To keep your weekly streak and get another bonus make pull request next week! Looking forward to see you in race-of-sloths

What is the Race of Sloths

Race of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow

For contributors:

  • Tag @race-of-sloths inside your pull requests
  • Wait for the maintainer to review and score your pull request
  • Check out your position in the Leaderboard
  • Keep weekly and monthly streaks to reach higher positions
  • Boast your contributions with a dynamic picture of your Profile

For maintainers:

  • Score pull requests that participate in the Race of Sloths
  • Engage contributors with fair scoring and fast responses so they keep their streaks
  • Promote the Race to the point where the Race starts promoting you
  • Grow the community of your contributors

Feel free to check our website for additional details!

Bot commands
  • For contributors
    • Include a PR: @race-of-sloths include to enter the Race with your PR
  • For maintainers:
    • Assign points: @race-of-sloths score [1/2/3/5/8/13] to award points based on your assessment.
    • Reject this PR: @race-of-sloths exclude to send this PR back to the drawing board.
    • Exclude repo: @race-of-sloths pause to stop bot activity in this repo until @race-of-sloths unpause command is called

@elliotBraem elliotBraem marked this pull request as ready for review August 6, 2024 03:25
@elliotBraem
Copy link
Contributor

@race-of-sloths score 5

@elliotBraem elliotBraem merged commit 0def6ee into main Aug 6, 2024
1 check passed
@elliotBraem elliotBraem deleted the 127-customize-gateway-from-bosconfigjson branch August 6, 2024 17:16
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 this pull request may close these issues.

Customize gateway from bos.config.json
3 participants