Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sourabh1007 committed Aug 9, 2023
1 parent 567ca55 commit 4137c58
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"CosmosDBEndPointUrl": "https://localhost:8081",
"CosmosDBAuthorizationKey": "Super secret key",
"ApplicationInsightsConnectionString": "Super secret connection string"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>Cosmos.Samples.ApplicationInsights</AssemblyName>
<RootNamespace>Cosmos.Samples.ApplicationInsights</RootNamespace>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand All @@ -13,9 +15,11 @@
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\AppSettings.json">
<None Include="AppSettings.json" Link="AppSettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
using System.Threading.Tasks;
using Newtonsoft.Json;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.WorkerService;
using Microsoft.Extensions.Logging.ApplicationInsights;

internal class Program
{
Expand All @@ -24,13 +26,13 @@ static async Task Main()
.AddJsonFile("AppSettings.json")
.Build();

string endpoint = configuration["EndPointUrl"];
string endpoint = configuration["CosmosDBEndPointUrl"];
if (string.IsNullOrEmpty(endpoint))
{
throw new ArgumentNullException("Please specify a valid CosmosDBEndPointUrl in the appSettings.json");
}

string authKey = configuration["AuthorizationKey"];
string authKey = configuration["CosmosDBAuthorizationKey"];
if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret key"))
{
throw new ArgumentException("Please specify a valid CosmosDBAuthorizationKey in the appSettings.json");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Logging": {
"OpenTelemetry": {
"LogLevel": {
"Azure.Cosmos.Operation.Request.Diagnostics": "Warning"
}
}
},
"CosmosDBEndPointUrl": "https://localhost:8081",
"CosmosDBAuthorizationKey": "Super secret key",
"ApplicationInsightsConnectionString": "Super secret connection string"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.6.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\AppSettings.json">
<None Include="AppSettings.json" Link="AppSettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ static async Task Main()
.AddJsonFile("AppSettings.json")
.Build();

string endpoint = configuration["EndPointUrl"];
string endpoint = configuration["CosmosDBEndPointUrl"];
if (string.IsNullOrEmpty(endpoint))
{
throw new ArgumentNullException("Please specify a valid CosmosDBEndPointUrl in the appSettings.json");
}

string authKey = configuration["AuthorizationKey"];
string authKey = configuration["CosmosDBAuthorizationKey"];
if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret key"))
{
throw new ArgumentException("Please specify a valid CosmosDBAuthorizationKey in the appSettings.json");
Expand Down
10 changes: 1 addition & 9 deletions Microsoft.Azure.Cosmos.Samples/Usage/appSettings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"EndPointUrl": "https://localhost:8081",
"AuthorizationKey": "Super secret key",
"ApplicationInsightsConnectionString": "Super secret connection string",
"Logging": {
"OpenTelemetry": {
"LogLevel": {
"Azure.Cosmos.Operation.Request.Diagnostics": "Warning"
}
}
}
"AuthorizationKey": "Super secret key"
}

0 comments on commit 4137c58

Please sign in to comment.