Skip to content

Commit

Permalink
feat(ci): chat service envs
Browse files Browse the repository at this point in the history
  • Loading branch information
javascriptizer1 committed Jun 15, 2024
1 parent a024c62 commit cf07cc9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/chat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,28 @@ jobs:
sudo apt-get update
sudo apt-get install -y gettext
- name: Create .env file
run: |
echo "ENV=${{ vars.ENV }}" >> .env
echo "MONGO_HOST=${{ vars.MONGO_HOST }}" >> .env
echo "MONGO_PORT=${{ vars.MONGO_PORT }}" >> .env
echo "MONGO_USER=${{ vars.MONGO_USER }}" >> .env
echo "MONGO_PASSWORD=${{ vars.MONGO_PASSWORD }}" >> .env
echo "MONGO_DB=${{ vars.MONGO_DB }}" >> .env
echo "GRPC_SERVER_HOST=${{ vars.GRPC_SERVER_HOST }}" >> .env
echo "GRPC_SERVER_PORT=${{ vars.GRPC_SERVER_PORT }}" >> .env
echo "GRPC_SERVER_TIMEOUT=${{ vars.GRPC_SERVER_TIMEOUT }}" >> .env
echo "GRPC_AUTH_HOST=${{ vars.GRPC_AUTH_HOST }}" >> .env
echo "GRPC_AUTH_PORT=${{ vars.GRPC_AUTH_PORT }}" >> .env
- name: Set up kubectl
run: |
mkdir -p $HOME/.kube
echo "$KUBE_CONFIG" | base64 --decode > $HOME/.kube/config
- name: Substitute environment variables in configmap
run: |
export $(grep -v '^#' $ENV | xargs)
export $(cat .env | xargs)
envsubst < deploy/helm/chat/templates/configmap.yaml > ./configmap.yaml
mv ./configmap.yaml deploy/helm/chat/templates/configmap.yaml
Expand Down
4 changes: 0 additions & 4 deletions service/chat/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
ENV=local

HTTP_SERVER_HOST=localhost
HTTP_SERVER_PORT=8080
HTTP_SERVER_TIMEOUT=60s

GRPC_SERVER_HOST=localhost
GRPC_SERVER_PORT=50052
GRPC_SERVER_TIMEOUT=50s
Expand Down
4 changes: 2 additions & 2 deletions service/chat/internal/config/config.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package config

import (
"log"
"net"
"strconv"
"time"

"github.com/ilyakaznacheev/cleanenv"
"github.com/javascriptizer1/grpc-cli-chat.backend/service/chat/internal/logger"
"github.com/joho/godotenv"
)

Expand Down Expand Up @@ -48,7 +48,7 @@ func MustLoad() *Config {
err := godotenv.Load()

if err != nil {
logger.Fatal("Error loading .env file")
log.Printf("Error loading .env file: %v", err)
}

var cfg Config
Expand Down

0 comments on commit cf07cc9

Please sign in to comment.