Skip to content

Commit

Permalink
Update local development docs (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
vazexqi committed Jul 17, 2024
1 parent 220c72f commit 1eacabc
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
4 changes: 4 additions & 0 deletions docs/articles/local-development-env-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: "Configuring Environment Variables"
sidebar_label: Environment variables
---

For security reasons, your local development does not have access to the
environment variables that you have configured on the Zuplo Portal. Instead,
your local Zuplo API Gateway will load environment variables from a .env file.

1. Create a .env file in the root of your project.
2. Follow the following format

Expand Down
28 changes: 19 additions & 9 deletions docs/articles/local-development-installing-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
title: "Installing Packages"
---

You can install packages from npm to use in your Zuplo Gateway, but bear in mind
these might not work in the cloud (i.e. working-copy and edge environments), as
Zuplo for security reasons does not allow all packages to be installed. Consult
https://zuplo.com/docs/articles/node-modules for the official list of supported
modules.

As of January 2024, we are looking into ways to support bringing in your own
modules. We are proceeding carefully as we want to ensure that we can provide a
secure and reliable experience for our users.
You can install packages from npm to use in your Zuplo Gateway. This can help
with code completion and hover tips.

However, bear in mind, these might not work out-of-the-box in the cloud (i.e.,
working-copy and edge environments), as Zuplo for security reasons does not
allow all packages to be installed. Consult
[Node Modules](https://zuplo.com/docs/articles/node-modules) for the official
list of supported modules.

There are workarounds though. If you need a package to be available, you can try
to _bundle_ it. This will bypass the `npm install` step since the module is
already bundled and available. We have an example at
[Custom Modules](https://github.com/zuplo/zuplo/tree/main/examples/custom-module)
that you can follow.

We are looking into ways to simplify bringing in your own modules. We are
proceeding carefully as we want to ensure that we can provide a secure and
reliable experience for our users. Please contact
[Zuplo support](mailto:support@zuplo.com) if you need more assistance.
6 changes: 3 additions & 3 deletions docs/articles/local-development-routes-designer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ title: "Routes Designer"
---

The Routes Designer is a visual tool that allows you to create and edit routes,
as well as adding [policies](../policies), for your Zuplo Gateway without having
to manually edit the OpenAPI `routes.oas.json` file manually.
as well as add [policies](../policies), for your Zuplo Gateway without having to
manually edit the OpenAPI `routes.oas.json` file manually.

When you run `npm run dev`, the Routes Designer is automatically started in
When you run `npm run dev`, the Routes Designer is automatically started on
port 9100. You can access it by visiting http://localhost:9100 in your browser.

```sh
Expand Down
14 changes: 13 additions & 1 deletion docs/articles/local-development-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,16 @@ committed to your version system. Consider adding .env to your .gitignore file.
4. You can run `npm run dev` as normal. The Zuplo CLI will automatically pick up
the relevant services from the `.env.zuplo` file.
5. If you want to switch environments (e.g., from development to preview), run
`npx zup link` again and select the new environment.
`npx zup link` again and select the new environment. You can see which
environment you are connected to by looking at the .env.zuplo file.

```bash title="Contents of .env.zuplo "
# This file is auto-generated from zup link. Please do not edit it manually.
# It will be auto-generated afresh the next time you run zup link.
# If you wish to add your own environment variables, create a separate .env file.

ZUPLO_ACCOUNT_NAME=your-account-name
ZUPLO_PROJECT_NAME=your-project-name
ZUPLO_ENVIRONMENT_TYPE=your-environment

```
7 changes: 3 additions & 4 deletions docs/articles/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Running your Zuplo Gateway locally
sidebar_label: Quickstart
---

You Zuplo API gateway can be configured and run on your machine for development
purposes, at the convenience of your code editor.
You can configure and run your Zuplo Gateway locally on your machine for
development purposes using your favorite code editor.

## Requirements

Expand Down Expand Up @@ -37,7 +37,7 @@ npm run dev
If you have been using Zuplo using the _Zuplo Web Portal_, you can import your
project into your local machine.

1. Connect your project to Github from the _Zuplo Web Portal_.
1. Connect your project to a Git repository from the _Zuplo Web Portal_.

![](https://cdn.zuplo.com/assets/3bd6b736-20d7-4ac4-805c-d7fd810dea28.png)

Expand Down Expand Up @@ -72,7 +72,6 @@ running your Zuplo Gateway locally:

- Analytics
- Developer Portal
- Tunnels

## Next steps

Expand Down

0 comments on commit 1eacabc

Please sign in to comment.