refactor: stop using the legacy standalone server

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2024-05-16 14:46:37 +02:00
parent 8fb30a5afe
commit 8869b8ef30
34 changed files with 209 additions and 860 deletions
@@ -0,0 +1,49 @@
/*
* Copyright 2024 The Backstage Authors
*
* 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.
*/
import { createBackend } from '@backstage/backend-defaults';
import {
coreServices,
createServiceFactory,
} from '@backstage/backend-plugin-api';
import { IdentityApi } from '@backstage/plugin-auth-node';
const identityMock: IdentityApi = {
async getIdentity({ request }) {
const token = request.headers.authorization?.split(' ')[1];
return {
identity: {
type: 'user',
ownershipEntityRefs: [],
userEntityRef: token || 'user:default/john_doe',
},
token: token || 'no-token',
};
},
};
const backend = createBackend();
backend.add(
createServiceFactory(() => ({
service: coreServices.identity,
deps: {},
async factory() {
return identityMock;
},
})),
);
backend.add(import('../src/alpha'));
backend.start();