From 1d69734c7fc380247cd5b26b7c3bb527266819c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikl=C3=B3s=20T=C3=B3th?= <tothmiklostibor@gmail.com>
Date: Thu, 11 Nov 2021 08:46:28 +0100
Subject: [PATCH] Add tls memes

---
 .gitlab-ci.yml | 17 -----------------
 db/data.go     | 10 ++++++++++
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1b874ac..f85b2d1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,20 +36,3 @@ build:
     - mkdir -p /kaniko/.docker
     - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
     - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
-
-deploy:
-  stage: deploy
-  image: kroniak/ssh-client
-  before_script:
-    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
-    - eval $(ssh-agent -s)
-    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-    - mkdir -p ~/.ssh
-    - chmod 700 ~/.ssh
-    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
-  script:
-    - ssh mike@sch.mikesweb.site "mkdir -p ~/deploy/vox"
-    - scp docker-compose.yml mike@sch.mikesweb.site:~/deploy/vox/
-    - ssh root@sch.mikesweb.site "cd /home/mike/deploy/vox; docker pull registry.mikesweb.site/vox:latest; docker-compose up -d --remove-orphans"
-  only:
-    - master
\ No newline at end of file
diff --git a/db/data.go b/db/data.go
index f62739d..4235904 100644
--- a/db/data.go
+++ b/db/data.go
@@ -1,6 +1,7 @@
 package db
 
 import (
+	"crypto/tls"
 	"fmt"
 	"git.sch.bme.hu/mikewashere/voxfrontend/languages"
 	"github.com/go-pg/pg/v10"
@@ -60,6 +61,15 @@ var db = pg.Connect(&pg.Options{
 		}
 		return pw
 	}(),
+	TLSConfig: func() *tls.Config {
+		if os.Getenv("NOTLS") == "true" {
+			return nil
+		} else {
+			return &tls.Config{
+				InsecureSkipVerify: true,
+			}
+		}
+	}(),
 })
 
 func init() {
-- 
GitLab