Skip to content

Commit b636339

Browse files
committed
set env test
1 parent 6db7830 commit b636339

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

Dockerfile.prod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ RUN apk --no-cache add ca-certificates
1515
WORKDIR /app
1616
COPY --from=builder /api .
1717

18+
ENTRYPOINT ["./docker-entrypoint.sh"]
1819
CMD ["./github_link_creator"]

docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if [ -n "$PARAMETER_STORE_PREFIX" ]; then
6+
export GITHUB_CLIRNT_ID=$(aws ssm get-parameters --name ${PARAMETER_STORE_PREFIX}/clientid --query "Parameters[0].Value" --region ap-northeast-1 --output text)
7+
export GITHUB_SECRET=$(aws ssm get-parameters --name ${PARAMETER_STORE_PREFIX}/clientsecret --with-decryption --query "Parameters[0].Value" --region ap-northeast-1 --output text)
8+
fi
9+
10+
exec "$@"

infrastructure/router.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package infrastructure
22

33
import (
4+
"net/http"
5+
"os"
6+
47
"github.com/gin-gonic/contrib/static"
58
"github.com/gin-gonic/gin"
69
"github.com/po3rin/github_link_creator/handler"
@@ -24,5 +27,10 @@ func (r *Router) InitRouter() *gin.Engine {
2427
router.Use(static.Serve("/", static.LocalFile("client/dist", true)))
2528
router.GET("/api/v1/health", r.Handler.HealthCheck)
2629
router.GET("/api/v1/images/:user/:repo", r.Handler.GetCode)
30+
router.GET("/api/v1/images/fdceda", func(c *gin.Context) {
31+
c.JSON(http.StatusOK, gin.H{
32+
"val": os.Getenv("GITHUB_CLIRNT_ID"),
33+
})
34+
})
2735
return router
2836
}

0 commit comments

Comments
 (0)