Skip to content

Commit e2fae4b

Browse files
committed
typos and system variables
1 parent 97a49a4 commit e2fae4b

File tree

6 files changed

+48
-40
lines changed

6 files changed

+48
-40
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ credentials.js
3232

3333
# webstorm project files
3434
.idea
35-
credentials_.js
35+
36+
.DS_store
37+
Thumbs.db
38+
*.bak

README-stg.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ get model URNs - as explained in the Setup/Usage Instructions.
4343
```
4444
cp credentials_.js credentials.js
4545
```
46-
* Replace the placeholder with your own keys in credentials.js, line #23 and #24 <br />
46+
* Replace the placeholders with your own keys in credentials.js, line #23 and #24 <br />
4747
```
48-
credentials.ClientId = '<replace with your consumer key>';
48+
credentials.ConsumerKey =process.env.CONSUMERKEY || '<replace with your consumer key>';
4949

50-
credentials.ClientSecret = '<replace with your consumer secret>';
50+
credentials.ConsumerSecret =process.env.CONSUMERSECRET || '<replace with your consumer secret>';
5151
```
5252
* In file credentials.js line #26, replace the BaseUrl address by the staging server address <br />
5353
```
@@ -56,7 +56,7 @@ get model URNs - as explained in the Setup/Usage Instructions.
5656
* Upload one of your models to your account and get its URN using another workflow sample, for example,
5757
- [this workflow sample in .Net WPF application](https://github.com/Developer-Autodesk/workflow-wpf-view.and.data.api) if you are using windows
5858
- or [this workflow sample in Mac OS Swift](https://github.com/Developer-Autodesk/workflow-macos-swift-view.and.data.api) if you are using Mac
59-
- or this [WEB page](http://javalmvwalkthrough-vq2mmximxb.elasticbeanstalk.com/)
59+
- or this [WEB page](http://models.autodesk.io/) or this [one](http://javalmvwalkthrough-vq2mmximxb.elasticbeanstalk.com/)
6060
* Copy the URN which was generated in the previous step in file /www/index.js at line #18 <br />
6161
```
6262
var defaultUrn = '<replace with your encoded urn>';

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ get model URNs - as explained in the Setup/Usage Instructions.
3434
```
3535
cp credentials_.js credentials.js
3636
```
37-
* Replace the placeholder with your own keys in credentials.js, line #23 and #24 <br />
37+
* Replace the placeholders with your own keys in credentials.js, line #23 and #24 <br />
3838
```
39-
credentials.ClientId = '<replace with your consumer key>';
39+
credentials.ConsumerKey =process.env.CONSUMERKEY || '<replace with your consumer key>';
4040

41-
credentials.ClientSecret = '<replace with your consumer secret>';
41+
credentials.ConsumerSecret =process.env.CONSUMERSECRET || '<replace with your consumer secret>';
4242
```
4343
* Upload one of your models to your account and get its URN using another workflow sample, for example,
4444
- [this workflow sample in .Net WPF application](https://github.com/Developer-Autodesk/workflow-wpf-view.and.data.api) if you are using windows
4545
- or [this workflow sample in Mac OS Swift](https://github.com/Developer-Autodesk/workflow-macos-swift-view.and.data.api) if you are using Mac
46-
- or this [WEB page](http://javalmvwalkthrough-vq2mmximxb.elasticbeanstalk.com/)
46+
- or this [WEB page](http://models.autodesk.io/) or this [one](http://javalmvwalkthrough-vq2mmximxb.elasticbeanstalk.com/)
4747
* Copy the URN which was generated in the previous step in file /www/index.js at line #18 <br />
4848
```
4949
var defaultUrn = '<replace with your encoded urn>';

credentials_.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ var credentials ={} ;
2020

2121
// Replace placeholder below by the Consumer Key and Consumer Secret you got from
2222
// http://developer.autodesk.com/ for the production server
23-
credentials.ClientId ='<replace with your consumer key>' ;
24-
credentials.ClientSecret ='<replace with your consumer secret>' ;
23+
credentials.ConsumerKey =process.env.CONSUMERKEY || '<replace with your consumer key>' ;
24+
credentials.ConsumerSecret =process.env.CONSUMERSECRET || '<replace with your consumer secret>' ;
2525

2626
// If you which to use the Autodesk View & Data API on the staging server, change this url
2727
credentials.BaseUrl = 'https://developer.api.autodesk.com' ;

package.json

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
{
22
"name": "AdnViewerBasic",
3-
"version": "0.0.0",
3+
"description": "A basic node.js server sample",
4+
"version": "1.0.0",
45
"dependencies": {
5-
"aws-sign2": "^0.5.0",
6-
"bl": "^0.9.4",
7-
"caseless": "^0.10.0",
8-
"combine-stream": "0.0.4",
9-
"combined-stream": "0.0.7",
10-
"express": "*",
11-
"forever-agent": "^0.6.1",
12-
"form-data": "^0.2.0",
13-
"har-validator": "^1.6.1",
14-
"hawk": "^2.3.1",
15-
"http-signature": "^0.11.0",
16-
"isstream": "^0.1.2",
17-
"json-stringify-safe": "^5.0.0",
18-
"mime-types": "^2.0.10",
19-
"node-uuid": "^1.4.3",
20-
"oauth-sign": "^0.7.0",
21-
"qs": "^2.4.1",
22-
"request": "*",
23-
"router": "^1.1.0",
24-
"serve-favicon": "*",
25-
"stringstream": "0.0.4",
26-
"tough-cookie": "^0.13.0",
27-
"tunnel-agent": "^0.4.0"
6+
"serve-favicon": ">= 2.2.0",
7+
"express": ">= 4.12.3",
8+
"request": ">= 2.55.0"
9+
},
10+
"files": [
11+
"LICENSE",
12+
"README.md"
13+
],
14+
"engines": {
15+
"node": ">= 0.10.0"
16+
},
17+
"contributors": [
18+
"Philippe Leefsma <[email protected]>"
19+
],
20+
"license": "MIT",
21+
"scripts": {
22+
"start": "node server.js"
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "https://github.com/Developer-Autodesk/workflow-node.js-view.and.data.api.git"
2827
}
2928
}

routes/api.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
1616
// UNINTERRUPTED OR ERROR FREE.
1717
/////////////////////////////////////////////////////////////////////////////////
18-
var credentials = require('../credentials');
19-
18+
var fs = require('fs');
19+
var credentials ;
20+
if ( !fs.existsSync ('credentials.js') ) {
21+
console.log ('No credentials.js file present, assuming using CONSUMERKEY & CONSUMERSECRET system variables.') ;
22+
credentials =require('../credentials_') ;
23+
} else {
24+
credentials =require('../credentials') ;
25+
}
2026
var express = require('express');
2127
var request = require('request');
2228

@@ -27,10 +33,10 @@ var router = express.Router();
2733
///////////////////////////////////////////////////////////////////////////////
2834
router.get('/token', function (req, res) {
2935
var params = {
30-
client_id: credentials.ClientId,
31-
client_secret: credentials.ClientSecret,
36+
client_id: credentials.ConsumerKey,
37+
client_secret: credentials.ConsumerSecret,
3238
grant_type: 'client_credentials'
33-
}
39+
} ;
3440

3541
request.post(
3642
credentials.BaseUrl + '/authentication/v1/authenticate',

0 commit comments

Comments
 (0)