Skip to content

Commit 62c1470

Browse files
Merge pull request #490 from snyk/refactor/snyk-api-url
refactor: default SNYK_API to api.snyk.io/v1
2 parents b31ad0a + af14395 commit 62c1470

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

docs/import.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ If you have any tests ot fixtures that should be ignored, please set the `exclus
190190
- `SNYK_TOKEN` - your [Snyk api token](https://app.snyk.io/account)
191191
- `SNYK_LOG_PATH` - the path to folder where all logs should be saved,it is recommended creating a dedicated logs folder per import you have running. (Note: all logs will append)
192192
- `CONCURRENT_IMPORTS` (optional) defaults to 15 repos at a time, which is the recommended amount to import at once as a max. Just 1 repo may have many projects inside which can trigger a many files at once to be requested from the user's SCM instance and some may have rate limiting in place. This script aims to help reduce the risk of hitting a rate limit.
193-
- `SNYK_API` (optional) defaults to `https://snyk.io/api/v1`
193+
- `SNYK_API` (optional) defaults to `https://api.snyk.io/v1`
194194

195195
## 3. Download & run
196196

docs/sync.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The command will produce detailed logs for projects that were `updated` and thos
9292

9393
- `SNYK_TOKEN` - your [Snyk api token](https://app.snyk.io/account)
9494
- `SNYK_LOG_PATH` - the path to folder where all logs should be saved,it is recommended creating a dedicated logs folder per import you have running. (Note: all logs will append)
95-
- `SNYK_API` (optional) defaults to `https://snyk.io/api/v1`
95+
- `SNYK_API` (optional) defaults to `https://api.snyk.io/v1`
9696
- `GITHUB_TOKEN` - SCM token that has read level or similar permissions to see information about repos like default branch & can list files in a repo
9797

9898
## 2. Download & run

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"bunyan": "1.8.15",
5151
"debug": "4.3.4",
5252
"lodash": "4.17.21",
53-
"micromatch": "4.0.6",
53+
"micromatch": "4.0.8",
5454
"needle": "2.9.1",
5555
"p-map": "4.0.0",
5656
"parse-link-header": "2.0.0",

src/lib/get-snyk-host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export function getSnykHost(): string {
2-
return process.env.SNYK_API || 'https://snyk.io/api/v1';
2+
return process.env.SNYK_API || 'https://api.snyk.io/v1';
33
}

test/lib/fixtures/non-empty.logx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{"name":"snyk:import-projects-script","hostname":"MacBook-Pro-2.local","pid":46657,"level":30,"target":{"name":"composer-with-vulns","owner":"api-import-circle-test","branch":"master"},"locationUrl":"https://dev.snyk.io/api/v1/org/ORG_ID/integrations/INTEGRATION_ID/import/IMPORT_ID","orgId":"ORG_ID","integrationId":"INTEGRATION_ID","targetId":"ORG_ID:INTEGRATION_ID:composer-with-vulns:api-import-circle-test:master","msg":"Target requested for import","time":"2020-10-26T14:53:20.234Z","v":0}
1+
{"name":"snyk:import-projects-script","hostname":"MacBook-Pro-2.local","pid":46657,"level":30,"target":{"name":"composer-with-vulns","owner":"api-import-circle-test","branch":"master"},"locationUrl":"https://api.dev.snyk.io/v1/org/ORG_ID/integrations/INTEGRATION_ID/import/IMPORT_ID","orgId":"ORG_ID","integrationId":"INTEGRATION_ID","targetId":"ORG_ID:INTEGRATION_ID:composer-with-vulns:api-import-circle-test:master","msg":"Target requested for import","time":"2020-10-26T14:53:20.234Z","v":0}
22
{"name":"snyk:import-projects-script","hostname":"MacBook-Pro-2.local","pid":46657,"level":30,"target":{"name":"composer-with-vulns","owner":"api-import-circle-test","branch":"master"},"locationUrl":null,"orgId":"ORG_ID","integrationId":"INTEGRATION_ID","targetId":"ORG_ID:INTEGRATION_ID:composer-with-vulns:api-import-circle-test:master","msg":"Target exists in Snyk","time":"2020-10-26T14:53:20.234Z","v":0}

test/scripts/__mocks__/snyk-request-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class requestsManager {
2020
statusCode: 201,
2121
headers: {
2222
location:
23-
'https://app.snyk.io/api/v1/org/ORG-ID/integrations/INTEGRATION-ID/import/IMPORT-ID',
23+
'https://api.snyk.io/v1/org/ORG-ID/integrations/INTEGRATION-ID/import/IMPORT-ID',
2424
},
2525
});
2626
}

test/scripts/polling.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('Logs failed polls', () => {
4949
await new Promise((r) => setTimeout(r, 300));
5050
const failedLog = fs.readFileSync(failedPollsLogName, 'utf8');
5151
expect(failedLog).toMatch(
52-
`"level":50,"orgId":"ORG-ID","locationUrl":"https://app.snyk.io/api/v1/org/ORG-ID/integrations/INTEGRATION-ID/import/IMPORT-ID","errorMessage":{"statusCode":500,"error":{"message":"Error calling Snyk api"}},"msg":"Failed to poll url"`,
52+
`"level":50,"orgId":"ORG-ID","locationUrl":"https://api.snyk.io/v1/org/ORG-ID/integrations/INTEGRATION-ID/import/IMPORT-ID","errorMessage":{"statusCode":500,"error":{"message":"Error calling Snyk api"}},"msg":"Failed to poll url"`,
5353
);
5454
}, 240000);
5555
});

test/system/orgs:data/gitlab.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('General `snyk-api-import orgs:data <...>`', () => {
2626
expect(stderr).toEqual('');
2727
expect(err).toBeNull();
2828
expect(stdout).toMatch(
29-
'Found 6 group(s). Written the data to file: group-hello-gitlab-orgs.json',
29+
'Found 7 group(s). Written the data to file: group-hello-gitlab-orgs.json',
3030
);
3131
deleteFiles([
3232
path.resolve(__dirname, `group-${groupId}-gitlab-orgs.json`),

0 commit comments

Comments
 (0)