Skip to content

Commit

Permalink
Fix config to be secret
Browse files Browse the repository at this point in the history
  • Loading branch information
fokolo committed Dec 18, 2024
1 parent 9051529 commit 27e05a0
Show file tree
Hide file tree
Showing 12 changed files with 954 additions and 53 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ For more than 15 users you need to get a license from [Port](https://backstage-p

- In Port, on the top right, click on the three dots and select **Credentials**
- Generate API credentials (Client ID and Client Secret)
- Add these credentials to your Backstage's `app-config.yaml` under the `backend`:
- Add these credentials to your Backstage's `app-config.yaml`:
```yaml
backend:
port:
api:
baseUrl: https://api.getport.io/
auth:
clientId: YOUR_CLIENT_ID
clientSecret: YOUR_CLIENT_SECRET
port:
api:
baseUrl: https://api.getport.io/
auth:
clientId: YOUR_CLIENT_ID
clientSecret: YOUR_CLIENT_SECRET
```
- [Find your Port credentials](https://docs.getport.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials)
Expand Down
1 change: 1 addition & 0 deletions backstage-plugins/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@backstage/plugin-catalog-graph": "^0.4.12",
"@backstage/plugin-catalog-import": "^0.12.6",
"@backstage/plugin-catalog-react": "^1.14.1",
"@backstage/plugin-devtools": "^0.1.22",
"@backstage/plugin-kubernetes": "^0.12.0",
"@backstage/plugin-org": "^0.6.32",
"@backstage/plugin-permission-react": "^0.4.28",
Expand Down
3 changes: 3 additions & 0 deletions backstage-plugins/packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CatalogImportPage,
catalogImportPlugin,
} from '@backstage/plugin-catalog-import';
import { DevToolsPage } from '@backstage/plugin-devtools';
import { orgPlugin } from '@backstage/plugin-org';
import { ScaffolderPage, scaffolderPlugin } from '@backstage/plugin-scaffolder';
import { SearchPage } from '@backstage/plugin-search';
Expand All @@ -16,6 +17,7 @@ import {
techdocsPlugin,
TechDocsReaderPage,
} from '@backstage/plugin-techdocs';

import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
import { UserSettingsPage } from '@backstage/plugin-user-settings';
Expand Down Expand Up @@ -116,6 +118,7 @@ const routes = (
{/* Port Labs */}
<Route path="/scorecards" element={<ScorecardsPage />} />
<Route path="/dev-daily" element={<DevDailyPluginPage />} />
<Route path="/devtools" element={<DevToolsPage />} />
</FlatRoutes>
);

Expand Down
2 changes: 2 additions & 0 deletions backstage-plugins/packages/app/src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { makeStyles } from '@material-ui/core';
import CreateComponentIcon from '@material-ui/icons/AddCircleOutline';
import AssignmentTurnedInIcon from '@material-ui/icons/AssignmentTurnedIn';
import BuildIcon from '@material-ui/icons/Build';
import DoneAll from '@material-ui/icons/DoneAll';
import ExtensionIcon from '@material-ui/icons/Extension';
import HomeIcon from '@material-ui/icons/Home';
Expand Down Expand Up @@ -97,6 +98,7 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
to="/settings"
>
<SidebarSettings />
<SidebarItem icon={BuildIcon} to="devtools" text="DevTools" />
</SidebarGroup>
</Sidebar>
{children}
Expand Down
1 change: 1 addition & 0 deletions backstage-plugins/packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@backstage/plugin-catalog-backend": "^1.28.0",
"@backstage/plugin-catalog-backend-module-logs": "^0.1.4",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.2",
"@backstage/plugin-devtools-backend": "^0.5.0",
"@backstage/plugin-kubernetes-backend": "^0.19.0",
"@backstage/plugin-permission-backend": "^0.5.51",
"@backstage/plugin-permission-backend-module-allow-all-policy": "^0.2.2",
Expand Down
1 change: 1 addition & 0 deletions backstage-plugins/packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ backend.add(import('@backstage/plugin-search-backend-module-techdocs'));

// kubernetes
backend.add(import('@backstage/plugin-kubernetes-backend'));
backend.add(import('@backstage/plugin-devtools-backend'));

backend.add(import('@backstage/plugin-auth-backend-module-github-provider'));

Expand Down
12 changes: 6 additions & 6 deletions backstage-plugins/plugins/backend-plugin/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ backend:
listen:
port: 7007

port:
api:
baseUrl: https://api.getport.io/
auth:
clientId:
clientSecret:
port:
api:
baseUrl: https://api.getport.io/
auth:
clientId:
clientSecret:
17 changes: 9 additions & 8 deletions backstage-plugins/plugins/backend-plugin/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
export interface Config {
backend: {
port: {
api: {
baseUrl: string;
auth: {
clientId: string;
clientSecret: string;
};
port: {
api: {
baseUrl: string;
/**
* @deepVisibility secret
*/
auth: {
clientId: string;
clientSecret: string;
};
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function createRouter(
options: RouterOptions,
): Promise<express.Handler> {
const { logger, config } = options;
const portConfig = config.getConfig('backend.port');
const portConfig = config.getConfig('port');
const baseUrl = portConfig.getString('api.baseUrl');
const clientId = portConfig.getString('api.auth.clientId');
const clientSecret = portConfig.getString('api.auth.clientSecret');
Expand Down
Loading

0 comments on commit 27e05a0

Please sign in to comment.