-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pushing template engine prototype as-is, so work can be picked up in …
…other time zones.
- Loading branch information
1 parent
9ea3251
commit a6e4e87
Showing
18 changed files
with
253 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 41 additions & 11 deletions
52
...rc/main/java/com/microsoft/aspire/extensions/spring/resources/EurekaServiceDiscovery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
aspire4j/aspire4j-extensions-spring/src/main/resources/templates/eureka/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
spring: | ||
application: | ||
name: ${name} | ||
server: | ||
port: ${port?c} | ||
eureka: | ||
client: | ||
register-with-eureka: ${registerWithEureka?string("true", "false")} | ||
fetch-registry: ${fetchRegistry?string("true", "false")} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
...extensions-spring/src/main/resources/templates/eureka/src/main/resources/application.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ire4j/src/main/java/com/microsoft/aspire/utils/templates/FreeMarkerTemplateProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.microsoft.aspire.utils.templates; | ||
|
||
import freemarker.template.Configuration; | ||
import freemarker.template.Template; | ||
import freemarker.template.TemplateException; | ||
import freemarker.template.Version; | ||
|
||
import java.io.IOException; | ||
import java.io.StringReader; | ||
import java.io.StringWriter; | ||
import java.util.Map; | ||
|
||
public class FreeMarkerTemplateProcessor implements TemplateEngine { | ||
|
||
@Override | ||
public String processTemplate(String templateContent, Map<String, Object> context) { | ||
Configuration cfg = new Configuration(new Version("2.3.31")); | ||
StringWriter out = new StringWriter(); | ||
|
||
try { | ||
Template template = new Template("template", new StringReader(templateContent), cfg); | ||
template.process(context, out); | ||
} catch (IOException | TemplateException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
return out.toString(); | ||
} | ||
} |
Oops, something went wrong.