backend-common: port config schema to d.ts and fill out

This commit is contained in:
Patrik Oldsberg
2020-11-15 20:47:04 +01:00
parent 06205426d8
commit 567ce7804a
3 changed files with 151 additions and 82 deletions
@@ -1,80 +0,0 @@
{
"$schema": "https://backstage.io/schema/config-v1",
"title": "@backstage/backend-common",
"type": "object",
"properties": {
"integrations": {
"type": "object",
"additionalProperties": false,
"properties": {
"github": {
"type": "array",
"items": {
"type": "object",
"required": ["host"],
"properties": {
"host": {
"type": "string"
},
"token": {
"type": "string",
"visibility": "secret"
}
}
}
},
"gitlab": {
"type": "array",
"items": {
"type": "object",
"required": ["host"],
"properties": {
"host": {
"type": "string"
},
"token": {
"type": "string",
"visibility": "secret"
}
}
}
},
"bitbucket": {
"type": "array",
"items": {
"type": "object",
"required": ["host"],
"properties": {
"host": {
"type": "string"
},
"username": {
"type": "string"
},
"appPassword": {
"type": "string",
"visibility": "secret"
}
}
}
},
"azure": {
"type": "array",
"items": {
"type": "object",
"required": ["host"],
"properties": {
"host": {
"type": "string"
},
"token": {
"type": "string",
"visibility": "secret"
}
}
}
}
}
}
}
}
+148
View File
@@ -0,0 +1,148 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Config {
frontend: {
baseUrl: string; // defined in core, but repeated here without doc
};
backend: {
baseUrl: string; // defined in core, but repeated here without doc
/** Address that the backend should listen to. */
listen:
| string
| {
/** Address of the interface that the backend should bind to. */
address?: string;
/** Port that the backend should listen to. */
port?: number;
};
/** HTTPS configuration for the backend. If omitted the backend will serve HTTP */
https?: {
/** Certificate configuration or parameters for generating a self-signed certificate */
certificate?:
| {
/** Algorithm to use to generate a self-signed certificate */
algorithm: string;
keySize?: number;
days?: number;
}
| {
/** PEM encoded certificate. Use $file to load in a file */
cert: string;
/**
* PEM encoded certificate key. Use $file to load in a file.
* @visibility secret
*/
key: string;
};
};
/** Database connection configuration, select database type using the `client` field */
database:
| {
client: 'sqlite3';
connection: ':memory:' | string;
}
| {
client: 'pg';
/**
* PostgreSQL connection string or knex configuration object.
* @secret
*/
connection: string | object;
};
cors?: {
origin?: string | string[];
methods?: string | string[];
allowedHeaders?: string | string[];
exposedHeaders?: string | string[];
credentials?: boolean;
maxAge?: number;
preflightContinue?: boolean;
optionsSuccessStatus?: number;
};
/** */
csp?: object;
};
/** Configuration for integrations towards various external repository provider systems */
integrations: {
/** Integration configuration for Azure */
azure: {
/** The hostname of the given Azure instance */
host: string;
/**
* Token used to authenticate requests.
* @visibility secret
*/
token?: string;
}[];
/** Integration configuration for BitBucket */
bitbucket: {
/** The hostname of the given Bitbucket instance */
host: string;
/**
* Token used to authenticate requests.
* @visibility secret
*/
token?: string;
/** The base url for the BitBucket API, for example https://api.bitbucket.org/2.0 */
apiBaseUrl?: string;
/**
* The username to use for authenticated requests.
* @visibility secret
*/
username?: string;
/**
* BitBucket app password used to authenticate requests.
* @visibility secret
*/
appPassword?: string;
}[];
/** Integration configuration for GitHub */
github: {
/** The hostname of the given GitHub instance */
host: string;
/**
* Token used to authenticate requests.
* @visibility secret
*/
token?: string;
/** The base url for the GitHub API, for example https://api.github.com */
apiBaseUrl?: string;
/** The base url for GitHub raw resources, for example https://raw.githubusercontent.com */
rawBaseUrl?: string;
}[];
/** Integration configuration for GitLab */
gitlab: {
/** The hostname of the given GitLab instance */
host: string;
/**
* Token used to authenticate requests.
* @visibility secret
*/
token?: string;
}[];
};
}
+3 -2
View File
@@ -89,7 +89,8 @@
"supertest": "^4.0.2"
},
"files": [
"dist"
"dist",
"config.d.ts"
],
"configSchema": "config-schema.json"
"configSchema": "config.d.ts"
}