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

Updating hello-kubernetes quickstart to support Endpoint env vars #1030

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tutorials/hello-kubernetes/node/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const app = express();
app.use(bodyParser.json());

// These ports are injected automatically into the container.
const daprPort = process.env.DAPR_HTTP_PORT ?? "3500";
const daprGRPCPort = process.env.DAPR_GRPC_PORT ?? "50001";
const daprHttpEndpoint = process.env.DAPR_HTTP_ENDPOINT ?? "http://localhost:3500";
const daprGRPCEndpoint = process.env.DAPR_GRPC_ENDPOINT ?? "http://localhost:50001";

const stateStoreName = process.env.STATE_STORE_NAME ?? "statestore";
const stateUrl = `http://localhost:${daprPort}/v1.0/state/${stateStoreName}`;
const stateUrl = `${daprHttpEndpoint}/v1.0/state/${stateStoreName}`;
const port = process.env.APP_PORT ?? "3000";

app.get('/order', async (_req, res) => {
Expand Down Expand Up @@ -71,9 +71,9 @@ app.post('/neworder', async (req, res) => {
});

app.get('/ports', (_req, res) => {
console.log("DAPR_HTTP_PORT: " + daprPort);
console.log("DAPR_GRPC_PORT: " + daprGRPCPort);
res.status(200).send({DAPR_HTTP_PORT: daprPort, DAPR_GRPC_PORT: daprGRPCPort })
console.log("DAPR_HTTP_ENDPOINT: " + daprHttpEndpoint);
console.log("DAPR_GRPC_ENDPOINT: " + daprGRPCEndpoint);
res.status(200).send({DAPR_HTTP_ENDPOINT: daprHttpEndpoint, DAPR_GRPC_ENDPOINT: daprGRPCEndpoint })
});

app.listen(port, () => console.log(`Node App listening on port ${port}!`));
4 changes: 2 additions & 2 deletions tutorials/hello-kubernetes/python/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import requests
import time

dapr_port = os.getenv("DAPR_HTTP_PORT", 3500)
dapr_url = "http://localhost:{}/neworder".format(dapr_port)
dapr_http_endpoint = os.getenv("DAPR_HTTP_ENDPOINT", "http://localhost:3500")
dapr_url = "{}/neworder".format(dapr_http_endpoint)

n = 0
while True:
Expand Down
Loading