From b9b1b9dfb1d6c2a27823c0132352735fd3b5fde7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Thu, 23 Feb 2023 11:04:41 +0100
Subject: [PATCH] Bugfix, podpora secrets

---
 .gitlab-ci.yml | 2 +-
 lib/CF2022.pm  | 7 +++++++
 sql/2/up.sql   | 6 ++----
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c2e0cfe..9fb5bb6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: docker:20.10.9
 
 variables:
   DOCKER_TLS_CERTDIR: "/certs"
-  IMAGE_VER: 0.12.0
+  IMAGE_VER: 0.12.1
 
 services:
   - docker:20.10.9-dind
diff --git a/lib/CF2022.pm b/lib/CF2022.pm
index 0925f47..8c76ef8 100644
--- a/lib/CF2022.pm
+++ b/lib/CF2022.pm
@@ -2,12 +2,19 @@ package CF2022;
 use Mojo::Base 'Mojolicious';
 use Mojo::Pg;
 use Mojo::Redis;
+use File::Find;
+use Path::Tiny qw( path );
 use CF2022::Schema;
 
+use constant SECRETS => '/run/secrets';
+
 # This method will run once at server start
 sub startup {
     my $self = shift;
 
+    # env z docker secrets
+    find(sub { $ENV{$_} = path(SECRETS . "/$_")->slurp if -f $_ }, SECRETS);
+
     my $cfg = $self->plugin('Config' => { file => 'cf2022.conf'} );
     $self->helper( cfg => sub { return $cfg; } );
 
diff --git a/sql/2/up.sql b/sql/2/up.sql
index 09a9a06..b94e747 100644
--- a/sql/2/up.sql
+++ b/sql/2/up.sql
@@ -1,4 +1,2 @@
-create sequence "uid_seq" start 100000;
-
-alter table order "orders" add column "response" text;
-alter table order "orders" add column "paid"  timestamp(0);
+alter table "orders" add column "response" text;
+alter table "orders" add column "paid"  timestamp(0);
-- 
GitLab