Skip to content

Commit

Permalink
Merge pull request #24 from Omegapoint/feature/update-key
Browse files Browse the repository at this point in the history
Function key for update
  • Loading branch information
jonathanbokvad authored Oct 3, 2023
2 parents 5972bc6 + 9aae4f6 commit ae58e1f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This repository contains the upload compliance state action.

### Development on already existing task (uploadcompliancestatetask)
## Development on upload-compliance-state

To start development, create a branch named **feature/your-branch-name**.

Expand All @@ -20,9 +20,14 @@ npm run format:write

Start developing and create tests, to run your test run: `npm run test`. When pushing the code the repository the workflow will build and push your code to the repository.

## Adding a new control to upload
### How to trigger the dev-function for upload-compliance-state
1. Ensure that a secret named ```URLUPDATEDEV``` has been created. [(Read more here on how to create a GitHub secret)](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository)
2. Make sure the secret is set as an environment variable ```urlUpdate``` in the workflow you are invoking.

Start with creating a branch named **feature/your-branch-name**.
```
env:
urlUpdate: ${{ secrets.URLUPDATEDEV }}
```

### How to log the badge
The UrlBody class contains all the badges/controls that will be logged in the workflow. The UrlBodyBuilder class is responsible for building the UrlBody. To add a badge for logging in the workflow, follow these steps:
Expand Down
4 changes: 3 additions & 1 deletion src/lib/ComplianceStateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export class ComplianceStateService {
subscriptionId: string
): Promise<void> {
// POST-request to Azure function
const urlUpdate: string = process.env.urlUpdate || '';
const updateKey: string = process.env.updateKey || '';
//Please update the func url if there are any changes to the infrastructure.
const urlUpdate: string = process.env.urlUpdate || 'https://func-cydig-comp-state-prod.azurewebsites.net/api/UpdateComplianceState?code=' + updateKey;
const bodyBuilder: BodyBuilder = new BodyBuilder();
const responseBody: ResponseBody = bodyBuilder.createBody(
teamName,
Expand Down
11 changes: 6 additions & 5 deletions src/lib/UrlBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ export class UrlBuilder {
subscriptionId: string,
states: object
): string {
//Don´t forget to implement this as github secrets in the repository
const urlReadToReadMe: string = process.env.urlRead || '';
//Please update the url if there are any changes to the infrastructure.
const urlDashboard: string = "https://cydig.omegapoint.cloud/";
const readToReadMeKeyAcessKey: string = process.env.readToReadMeKeyAcessKey || '';
//Please update the func url if there are any changes to the infrastructure.
const readFunctionURL: string = 'https://func-cydig-comp-state-prod.azurewebsites.net/api/ReadToReadme?code=';
//Please update the url if there are any changes to the infrastructure.
const readToReadMeKeyAcessKey: string = 'xaEvCDsaK01y2Z6SBivwOKndN4o915lpOTt1VkmULgsxgsjkml7u1DOhgULzmAPX';

let urls: string = '';
let encodedURL: string;
let singleBadgeURL: string;
let redirectLink: string = '';
const readFunctionURL: string = urlReadToReadMe;

//OP Dashboard
encodedURL = encodeURIComponent('OP Compliance Dashboard-click here-blue');
Expand All @@ -26,7 +28,6 @@ export class UrlBuilder {
//timestamp
encodedURL = encodeURIComponent(
readFunctionURL +
'code=' +
readToReadMeKeyAcessKey +
'&teamName=' +
encodeURIComponent(teamName) +
Expand Down

0 comments on commit ae58e1f

Please sign in to comment.