Skip to content

Remove required env variables #352

@davidebianchi

Description

@davidebianchi

The feauture or bug you are proposing

Here are set the default variables required by the cpl

const baseSchema = {
type: 'object',
required: [
USERID_HEADER_KEY,
GROUPS_HEADER_KEY,
CLIENTTYPE_HEADER_KEY,
BACKOFFICE_HEADER_KEY,
MICROSERVICE_GATEWAY_SERVICE_NAME,
],
properties: {
[USERID_HEADER_KEY]: {
type: 'string',
description: 'the header key to get the user id',
minLength: 1,
},
[USER_PROPERTIES_HEADER_KEY]: {
type: 'string',
description: 'the header key to get the user permissions',
minLength: 1,
default: 'miauserproperties',
},
[GROUPS_HEADER_KEY]: {
type: 'string',
description: 'the header key to get the groups comma separated list',
minLength: 1,
},
[CLIENTTYPE_HEADER_KEY]: {
type: 'string',
description: 'the header key to get the client type',
minLength: 1,
},
[BACKOFFICE_HEADER_KEY]: {
type: 'string',
description: 'the header key to get if the request is from backoffice (any truly string is true!!!)',
minLength: 1,
},
[MICROSERVICE_GATEWAY_SERVICE_NAME]: {
type: 'string',
description: 'the service name of the microservice gateway',
pattern: '^(?=.{1,253}.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*.?$',
},
[ADDITIONAL_HEADERS_TO_PROXY]: {
type: 'string',
default: '',
description: 'comma separated list of additional headers to proxy',
},
[ENABLE_HTTP_CLIENT_METRICS]: {
type: 'boolean',
default: false,
description: 'flag to enable the httpClient metrics',
},
},
}

For example, there is also the MICROSERVICE_GATEWAY_SERVICE_NAME env var, also if microservice-gateway does not exists in project.

For my point of view, it's ok which are configurable but this env should not be required. Also, the MICROSERVICE_GATEWAY_SERVICE_NAME should be optional and enable/disable the pre/post decorator function (raising an error).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions