Skip to content

Commit

Permalink
Merge pull request #330 from watson-developer-cloud/5980-load-credent…
Browse files Browse the repository at this point in the history
…ials-from-file

Load credentials from file
  • Loading branch information
mediumTaj authored Feb 1, 2019
2 parents 7df3738 + 3a0dfb2 commit dd1a1f9
Show file tree
Hide file tree
Showing 30 changed files with 1,447 additions and 1,117 deletions.
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"exclude_regex": null,
"generated_at": "2019-01-16T21:58:27Z",
"generated_at": "2019-01-31T23:42:02Z",
"plugins_used": [
{
"base64_limit": 4.5,
Expand Down Expand Up @@ -55,13 +55,13 @@
{
"hashed_secret": "c51238bc51c3b0abee7f61d90c414aec89009734",
"is_secret": false,
"line_number": 48,
"line_number": 49,
"type": "Basic Auth Credentials"
},
{
"hashed_secret": "3f820839b94508b2a9dc3b3e6e1149080af8780c",
"is_secret": false,
"line_number": 83,
"line_number": 84,
"type": "Basic Auth Credentials"
}
]
Expand Down
9 changes: 8 additions & 1 deletion IBM.WatsonDeveloperCloud.sln
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.WatsonDeveloperCloud.Co
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.WatsonDeveloperCloud.CompareComply.v1.IT", "test\IBM.WatsonDeveloperCloud.CompareComply.v1.IT\IBM.WatsonDeveloperCloud.CompareComply.v1.IT.csproj", "{42258A9B-CE18-4C39-BAA5-19F8C5DE041B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IBM.WatsonDeveloperCloud.CompareComply.v1.UT", "test\IBM.WatsonDeveloperCloud.CompareComply.v1.UT\IBM.WatsonDeveloperCloud.CompareComply.v1.UT.csproj", "{DF7A03F2-66F3-4B70-8311-A3487553CA0C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.WatsonDeveloperCloud.CompareComply.v1.UT", "test\IBM.WatsonDeveloperCloud.CompareComply.v1.UT\IBM.WatsonDeveloperCloud.CompareComply.v1.UT.csproj", "{DF7A03F2-66F3-4B70-8311-A3487553CA0C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.WatsonDeveloperCloud.Core.IntegrationTests", "test\IBM.WatsonDeveloperCloud.Core.IntegrationTests\IBM.WatsonDeveloperCloud.Core.IntegrationTests.csproj", "{03A84C2E-8285-483E-8BD2-4A367DDFF230}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -319,6 +321,10 @@ Global
{DF7A03F2-66F3-4B70-8311-A3487553CA0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF7A03F2-66F3-4B70-8311-A3487553CA0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF7A03F2-66F3-4B70-8311-A3487553CA0C}.Release|Any CPU.Build.0 = Release|Any CPU
{03A84C2E-8285-483E-8BD2-4A367DDFF230}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03A84C2E-8285-483E-8BD2-4A367DDFF230}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03A84C2E-8285-483E-8BD2-4A367DDFF230}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03A84C2E-8285-483E-8BD2-4A367DDFF230}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -385,6 +391,7 @@ Global
{0287B6FD-D28A-47C9-9686-C4658EBD2129} = {B368DCF7-FB57-4302-8467-4EB142394A29}
{42258A9B-CE18-4C39-BAA5-19F8C5DE041B} = {B368DCF7-FB57-4302-8467-4EB142394A29}
{DF7A03F2-66F3-4B70-8311-A3487553CA0C} = {B368DCF7-FB57-4302-8467-4EB142394A29}
{03A84C2E-8285-483E-8BD2-4A367DDFF230} = {FF4673C9-CB33-4D4F-9116-776A792A2189}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B9D9D17B-1C17-402F-B701-DC671528690A}
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ void Example()
}
```

### ibm-credentials.env
You can create an ibm-credentials.env file for authentication. This has the basic format
```
VISUAL_RECOGNITION_APIKEY=<visual-recognition-apikey>
VISUAL_RECOGNITION_URL=<visual-recognition-service-url>
ASSISTANT_APIKEY=<assistant-apikey>
ASSISTANT_URL=<assistant-service-url>
```
The SDK will search for this file in the following order
- Path specified by environmental variable `IBM_CREDENTIALS_FILE`
- System home directory
- Top level of the project directory

Using a `ibm-credentials.env` file you can easily instantiate and authenticate a service.
```
AssistantService assistantService = new AssistantService();
var listWorkspacesResult = assistantService.ListWorkspaces();
```

## Custom Request Headers
You can send custom request headers by adding them to the `customData` object.
```cs
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ environment:
secure: gevsMhy8RTWMdf7MjOnIo5QaN6JpL9DPK6I+Go5ByZir5LDwyFsv9hO6nBjGTg8n
GITHUB_TOKEN:
secure: +B2bs86RVtJtlbkB+cTf9bkqnNlFJi/PbBBPzR5jlUlLLZoOc+ZgqgQLwee4tCT+
IBM_CREDENTIALS_FILE: C:\projects\sdk-credentials\ibm-credentials.env
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
Expand Down
Loading

0 comments on commit dd1a1f9

Please sign in to comment.