Skip to content

Commit

Permalink
refactor: message error and add HttpMethodTypeAny definition
Browse files Browse the repository at this point in the history
  • Loading branch information
loopingz committed Jul 7, 2023
1 parent ebe7f81 commit 58ee00b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# Kubernetes Configuration Service

This service map a `SecretMap` or a `ConfigMap` to a JSON object
This service will load and hot reload configuration from a `ConfigMap` or `Secret` in Kubernetes.

Each key/value equals to the root of a branch
The usual flow is to use `FileConfigurationService` in dev, and then switch it for the `KubernetesConfigurationService` in production.

If the key ends with '.yaml' or '.json' it will be parsed, otherwise the full content is returned
You have to configure the folder when the secret will be mounted

```
"kubernetes": {
"source": "/secrets"
}
```

The service will take the first of `webda.jsonc?` or `webda.yaml` as configuration

To create the secret from your `local.config.jsonc` you can use the following command

```bash
kubectl create secret generic my-secret-name --from-file=webda.jsonc=local.config.jsonc
```
2 changes: 1 addition & 1 deletion packages/core/src/services/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export abstract class OAuthService<
let redirect = ctx.getParameters().redirect || ctx.getHttpContext().getHeaders().referer;

if (!this.isAuthorizedUri(redirect, ctx)) {
throw new WebdaError.Unauthorized("Unauthorized redirect_uri");
throw new WebdaError.Unauthorized("Unauthorized redirect parameter");
}

const session = ctx.getSession<OAuthSession>();
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/utils/httpcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { IncomingHttpHeaders } from "http";
import { Readable } from "stream";

export type HttpMethodType = "GET" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "DELETE";
/**
* All methods supported by Webda
*/
export const HttpMethodTypeAny: HttpMethodType[] = ["GET", "OPTIONS", "POST", "PUT", "PATCH", "DELETE"];

type HeadersRequest = IncomingHttpHeaders & {
// Permit any property starting with 'x-'.
Expand Down

0 comments on commit 58ee00b

Please sign in to comment.