Skip to content

Commit

Permalink
Make this configuration automatic
Browse files Browse the repository at this point in the history
Assuming this configuration is intended for the use during the
development time, we can have Maven auto-insert the right value.
  • Loading branch information
kohsuke committed Oct 28, 2024
1 parent b06f89d commit a520ea7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<artifactId>maven-hpi-plugin</artifactId>
<configuration>
<defaultPort>8081</defaultPort>
<systemProperties>
<INSIGHT_UPLOAD_URL>http://localhost:8080</INSIGHT_UPLOAD_URL>
</systemProperties>
</configuration>
</plugin>
</plugins>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/io/jenkins/plugins/launchable/Ingester.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
public class Ingester extends GlobalConfiguration {
private Secret apiKey;

public Ingester() {
load();
}

public Secret getApiKey() {
return apiKey;
}
Expand Down Expand Up @@ -54,7 +58,7 @@ public boolean configure(StaplerRequest req, JSONObject json) throws FormExcepti
// attempted to use JDK HttpRequest, but gave up due to the lack of multipart support
// TODO: how do I obtain a properly configured HttpClient for the proxy setting in Jenkins?
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
String endpoint = System.getenv("INSIGHT_UPLOAD_URL") ;
String endpoint = System.getProperty("INSIGHT_UPLOAD_URL") ;

if (endpoint==null) {
endpoint = DEFAULT_UPLOAD_URL;
Expand Down

0 comments on commit a520ea7

Please sign in to comment.