Compare commits
1 commit
main
...
experiment
Author | SHA1 | Date | |
---|---|---|---|
|
c43d0e7295 |
2 changed files with 23 additions and 3 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/zitadel/oidc/v2/example/server/exampleop"
|
"github.com/zitadel/oidc/v2/example/server/exampleop"
|
||||||
"github.com/zitadel/oidc/v2/example/server/storage"
|
"github.com/zitadel/oidc/v2/example/server/storage"
|
||||||
|
@ -12,8 +13,12 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
//we will run on :9998
|
//we will run on :9998
|
||||||
port := "9998"
|
port := "9998"
|
||||||
|
|
||||||
|
issuer, ok := os.LookupEnv("ISSUER")
|
||||||
|
if !ok {
|
||||||
//which gives us the issuer: http://localhost:9998/
|
//which gives us the issuer: http://localhost:9998/
|
||||||
issuer := fmt.Sprintf("http://localhost:%s/", port)
|
issuer = fmt.Sprintf("http://localhost:%s/", port)
|
||||||
|
}
|
||||||
|
|
||||||
// the OpenIDProvider interface needs a Storage interface handling various checks and state manipulations
|
// the OpenIDProvider interface needs a Storage interface handling various checks and state manipulations
|
||||||
// this might be the layer for accessing your database
|
// this might be the layer for accessing your database
|
||||||
|
@ -26,7 +31,7 @@ func main() {
|
||||||
Addr: ":" + port,
|
Addr: ":" + port,
|
||||||
Handler: router,
|
Handler: router,
|
||||||
}
|
}
|
||||||
log.Printf("server listening on http://localhost:%s/", port)
|
log.Printf("server listening on %s", issuer)
|
||||||
log.Println("press ctrl+c to stop")
|
log.Println("press ctrl+c to stop")
|
||||||
err := server.ListenAndServe()
|
err := server.ListenAndServe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
15
static-op.Dockerfile
Normal file
15
static-op.Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
FROM golang:latest as build
|
||||||
|
|
||||||
|
COPY go.mod go.sum /build/
|
||||||
|
WORKDIR /build
|
||||||
|
RUN go mod download -x
|
||||||
|
|
||||||
|
COPY . /build/
|
||||||
|
RUN go build ./example/server
|
||||||
|
|
||||||
|
FROM busybox:glibc
|
||||||
|
COPY --from=build /build/server /usr/local/bin/server
|
||||||
|
|
||||||
|
ENV ISSUER=http://localhost:9998/
|
||||||
|
EXPOSE 9998
|
||||||
|
CMD [ "/usr/local/bin/server" ]
|
Loading…
Add table
Add a link
Reference in a new issue