Skip to content

Commit c02f1ea

Browse files
authored
Updated key/endpoint
Endpoints are not region-based anymore, but rather custom domain -based. Although regional endpoints will still work. Also, the authentication information is moving to a standard of getting it from environment variables.
1 parent 8e0ae1c commit c02f1ea

File tree

1 file changed

+7
-5
lines changed
  • ContentModerator/src/main/java/com/microsoft/azure/contentmoderator/samples

1 file changed

+7
-5
lines changed

ContentModerator/src/main/java/com/microsoft/azure/contentmoderator/samples/Samples.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public Response intercept(Interceptor.Chain chain) throws IOException {
5757
}
5858
});
5959
}
60-
}).withBaseUrl("https://westus.api.cognitive.microsoft.com");
60+
}).withBaseUrl(System.getenv("CONTENT_MODERATOR_ENDPOINT")); // Add your endpoint to your environment variables.
6161
}
6262

6363
static String readFileContents(String filePath) throws IOException {
@@ -82,16 +82,18 @@ static String readFileContents(String filePath) throws IOException {
8282
public static void main(String[] args) {
8383
try {
8484
if(apiKey == null) {
85-
apiKey = System.getenv("AZURE_CONTENT_MODERATOR_API_KEY");
85+
// Add your Azure Content Moderator subscription key to your environment variables.
86+
apiKey = System.getenv(System.getenv("CONTENT_MODERATOR_SUBSCRIPTION_KEY"));
8687
if(apiKey == null) {
87-
throw new Exception("Azure content moderator samples api key not found.");
88+
throw new Exception("Azure Content Moderator key not found.");
8889
}
8990
}
9091

9192
if(TeamName == null) {
92-
TeamName = System.getenv("AZURE_CONTENT_MODERATOR_TEAM_NAME");
93+
// Add your Azure Content Moderator team name to your environment variables.
94+
TeamName = System.getenv("CONTENT_MODERATOR_TEAM_NAME");
9395
if(TeamName == null) {
94-
throw new Exception("Azure content moderator samples team name not found.");
96+
throw new Exception("Azure Content Moderator team name not found.");
9597
}
9698
}
9799

0 commit comments

Comments
 (0)