Skip to content

Commit

Permalink
feat!: Removed environment variables from client, it is callers respo…
Browse files Browse the repository at this point in the history
…nsibility. Removed monolithic repositoy object and added space awareness to individual repository implementations
  • Loading branch information
slewis74 authored Dec 5, 2022
1 parent 03eddec commit 86e86e1
Show file tree
Hide file tree
Showing 272 changed files with 3,639 additions and 5,642 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,31 @@ jobs:
statuses: write
checks: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: 16
registry-url: 'https://registry.npmjs.org'
scope: '@octopusdeploy'
- run: npm install
- run: |
curl '${{ env.SERVER_URL }}/api/configuration/webportal/values' -X 'PUT' -H 'Content-Type: application/json' -H 'X-Octopus-ApiKey: ${{ env.ADMIN_API_KEY }}' --data-binary '{"Security":{"CorsWhitelist":"http://localhost,${{ env.SERVER_URL }}","ReferrerPolicy":"no-referrer","ContentSecurityPolicyEnabled":true,"HttpStrictTransportSecurityEnabled":false,"HttpStrictTransportSecurityMaxAge":31556926,"XOptions":{"XFrameOptionAllowFrom":null,"XFrameOptions":"None"}}}' -o /dev/null -s -w "%{http_code}\n"
name: Add server url to CORS
- run: npm run test
name: 'Run the tests'
env:
OCTOPUS_URL: ${{ env.SERVER_URL }}
OCTOPUS_API_KEY: ${{ env.ADMIN_API_KEY }}
- uses: dorny/test-reporter@v1
if: success() || failure()
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: 16
registry-url: 'https://registry.npmjs.org'
scope: '@octopusdeploy'
- run: npm install
- run: |
curl '${{ env.SERVER_URL }}/api/configuration/webportal/values' -X 'PUT' -H 'Content-Type: application/json' -H 'X-Octopus-ApiKey: ${{ env.ADMIN_API_KEY }}' --data-binary '{"Security":{"CorsWhitelist":"http://localhost,${{ env.SERVER_URL }}","ReferrerPolicy":"no-referrer","ContentSecurityPolicyEnabled":true,"HttpStrictTransportSecurityEnabled":false,"HttpStrictTransportSecurityMaxAge":31556926,"XOptions":{"XFrameOptionAllowFrom":null,"XFrameOptions":"None"}}}' -o /dev/null -s -w "%{http_code}\n"
name: Add server url to CORS
- run: npm run test
name: 'Run the tests'
env:
OCTOPUS_TEST_URL: ${{ env.SERVER_URL }}
OCTOPUS_TEST_API_KEY: ${{ env.ADMIN_API_KEY }}

- uses: dorny/test-reporter@v1
if: success() || failure()
name: Tests report
with:
name: Tests report
with:
name: Tests report
path: 'reports/jest-*.xml'
reporter: jest-junit
path: 'reports/jest-*.xml'
reporter: jest-junit
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
lib/
node_modules/
.github/workflows/
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"tabWidth": 4,
"trailingComma": "es5",
"endOfLine": "auto"
}
}
27 changes: 8 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,14 @@ The reference documentation for this library is auto-generated via [Typedoc](htt
import { Client, ClientConfiguration, Repository } from "@octopusdeploy/api-client";
import type { ProjectResource } from "@octopusdeploy/message-contracts";

// explicit configuration
//
// const configuration: ClientConfiguration = {
// agent: new Agent({ proxy: { hostname: '127.0.0.1', port: 8866 } }), // proxy agent if required
// apiKey: "api-key",
// apiUri: "api-uri",
// space: "space-id",
// };
//
// const client = await Client.create(configuration);

// environment variables
//
// OCTOPUS_API_KEY: the API key used to connect to an instance of Octopus Deploy
// OCTOPUS_URL: the host instance of Octopus Deploy
// OCTOPUS_SPACE: the space to target API commands in Octopus Deploy

// assume conventional configuration via environment variables
const client = await Client.create();
const configuration: ClientConfiguration = {
instanceURL: "instance-url",
apiKey: "api-key",
space: "space-id",
agent: new Agent({ proxy: { hostname: "127.0.0.1", port: 8866 } }), // proxy agent if required
};

const client = await Client.create(configuration);
if (client === undefined) {
throw new Error("client could not be constructed");
}
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/interfaces/ClientConfiguration.html

Large diffs are not rendered by default.

Loading

0 comments on commit 86e86e1

Please sign in to comment.