Skip to content

Commit

Permalink
fix: Hello world action exposed to the internet in code first archety…
Browse files Browse the repository at this point in the history
  • Loading branch information
aludwiko authored and aklikic committed Jan 15, 2024
1 parent 16e01fe commit ba3d16c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ${package}.hello;

import kalix.javasdk.action.Action;
import kalix.javasdk.annotations.Acl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
* This is a simple Action that returns "Hello World!".
* Locally, you can access it by running `curl http://localhost:9000/hello`.
*/
@RequestMapping
// Exposing action to the Internet.
@Acl(allow = @Acl.Matcher(principal = Acl.Principal.INTERNET))
public class HelloWorld extends Action {

@GetMapping("/hello")
public Action.Effect<String> hello() {
return effects().reply("Hello World!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<dockerImage>${D}{kalixContainerRegistry}/${D}{kalixOrganization}/${D}{project.artifactId}</dockerImage>
<dockerTag>${project.version}-${build.timestamp}</dockerTag>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<mainClass>${package}.Main</mainClass>
<mainClass>${package}.MainKt</mainClass>

<jdk.target>17</jdk.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ${package}.hello;

import kalix.javasdk.action.Action
import kalix.javasdk.annotations.Acl
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping

/**
* This is a simple Action that returns "Hello World!".
* Locally, you can access it by running `curl http://localhost:9000/hello`.
*/
@RequestMapping
// Exposing action to the Internet.
@Acl(allow = [Acl.Matcher(principal = Acl.Principal.INTERNET)])
class HelloWorld : Action() {

@GetMapping("/hello")
fun hello(): Effect<String> {
return effects().reply("Hello World!")
}
}

0 comments on commit ba3d16c

Please sign in to comment.