Skip to content

Commit 10c8fff

Browse files
committed
refactor: simplify service spec
1 parent a4fa4af commit 10c8fff

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

SERVICES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ To register a service with the gateway to make it available for use from the [Tu
66
```toml
77
[services.name] # where 'name' is a unique kebab-case name for your service
88
path="/myservice" # unique path the frontend will make a request to at /api[path]
9-
target_host="https://my-service.default.svc.cluster.local" # the host for the service
10-
target_port=8080 # the target port for your service
9+
host="https://my-service.default.svc.cluster.local" # the host for the service
10+
port=8080 # the target port for your service
1111
```
1212
- add an entry for your service in the list below with a brief description of your service and a link to the documentation
1313

gateway_config.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
auth_url = "example.com"
12
whitelist = [
23
"localhost/*"
34
]
45

56
[services.users]
6-
path="/users"
7-
target_service="http://user-service.default.svc.cluster.local"
8-
target_port=8080
7+
host="http://user-service.default.svc.cluster.local"
8+
port=8080
99

1010
[services.orders]
11-
path="/orders"
12-
target_service="http://order-service.default.svc.cluster.local"
13-
target_port=8080
11+
host="http://order-service.default.svc.cluster.local"
12+
port=8080
13+
14+
[services.test]
15+
host="https://google.com"
16+
port=443

src/config.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ use std::{fs::File, io::Read};
44

55
#[derive(Serialize, Deserialize, Debug, Clone)]
66
pub struct ServiceConfig {
7-
pub path: String,
8-
pub target_host: String,
9-
pub target_port: u32,
7+
pub host: String,
8+
pub port: u32,
109
}
1110

1211
#[derive(Serialize, Deserialize, Debug, Clone)]

0 commit comments

Comments
 (0)