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

static port mapping for local development #560

Closed
jyecusch opened this issue Jan 29, 2024 · 5 comments · Fixed by nitrictech/cli#777
Closed

static port mapping for local development #560

jyecusch opened this issue Jan 29, 2024 · 5 comments · Fixed by nitrictech/cli#777
Assignees
Labels
enhancement New feature or request

Comments

@jyecusch
Copy link
Member

Feature Request

Suggestion

Allow for API and other entrypoint ports to be set to static values based on the resource's name.

Value

Allow local development which includes automated tests or UIs that interact with the APIs to be configured once, avoiding port changes when new APIs are added to existing projects.

@jyecusch jyecusch added the enhancement New feature or request label Jan 29, 2024
@davemooreuws
Copy link
Member

Just a note that this is implemented via an env var with http proxies.

@chimon2000
Copy link
Sponsor

@davemooreuws is there an example?

@davemooreuws
Copy link
Member

@davemooreuws is there an example?

Hey @chimon2000, the http proxy one was done on the SDK level (for the node-sdk).

https://github.com/nitrictech/node-sdk/blob/6bc461c399c17177f9ce0c0454e0adfd40d292ed/src/resources/http.ts#L111

I think the feature request might be looking for something more generic and broad in the nitric yaml like: @jyecusch

ports:
  main: 4001
  private: 4002

@chimon2000
Copy link
Sponsor

chimon2000 commented Aug 13, 2024 via email

@davemooreuws
Copy link
Member

Finished, example config local.nitric.yaml:

# local.nitric.yaml
# Local development configuration for Nitric services.

apis:
  # API Resources
  first-api:
    port: 6001

  second-api:
    port: 6002

  my-db-api:
    port: 6003

  my-secret-api:
    port: 6004

websockets:
  # WebSocket Resources
  socket:
    port: 7001

  socket-2:
    port: 7002

  socket-3:
    port: 7002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants