From b9b297500e55fc8b79845df6798b4c4dfbbc5dc7 Mon Sep 17 00:00:00 2001
From: Andrey Ivanov <tiburon-777@users.noreply.github.com>
Date: Wed, 25 Nov 2020 15:39:22 +0300
Subject: [PATCH] HW15 WIP

---
 .golangci.yml                                 |   3 +-
 hw12_13_14_15_calendar/Makefile               |  14 ++-
 .../{grpcserver.proto => private.proto}       |   0
 .../public/{grpcserver.proto => public.proto} |   0
 .../cicd/calendar/Dockerfile                  |  28 +++++
 .../cicd/docker-compose.yml                   |  24 +++-
 .../cicd/scheduler/Dockerfile                 |  22 ++++
 hw12_13_14_15_calendar/cicd/sender/Dockerfile |  20 ++++
 hw12_13_14_15_calendar/cmd/calendar/main.go   |  17 +--
 hw12_13_14_15_calendar/cmd/scheduler/main.go  |   2 +-
 hw12_13_14_15_calendar/configs/calendar.conf  |   6 +-
 hw12_13_14_15_calendar/go.mod                 |   3 +-
 hw12_13_14_15_calendar/go.sum                 |   2 +
 .../{grpcserver.pb.go => private.pb.go}       |  64 +++++-----
 .../internal/api/private/server.go            |   2 +-
 .../public/{grpcserver.pb.go => public.pb.go} | 109 +++++++++---------
 .../{grpcserver.pb.gw.go => public.pb.gw.go}  |   2 +-
 .../pkg/api/public/server.go                  |   2 +-
 hw12_13_14_15_calendar/pkg/config/config.go   |  57 ++++++++-
 .../pkg/config/config_test.go                 |  29 +++++
 hw12_13_14_15_calendar/pkg/logger/logger.go   |   1 +
 21 files changed, 293 insertions(+), 114 deletions(-)
 rename hw12_13_14_15_calendar/api/private/{grpcserver.proto => private.proto} (100%)
 rename hw12_13_14_15_calendar/api/public/{grpcserver.proto => public.proto} (100%)
 create mode 100644 hw12_13_14_15_calendar/cicd/calendar/Dockerfile
 create mode 100644 hw12_13_14_15_calendar/cicd/scheduler/Dockerfile
 create mode 100644 hw12_13_14_15_calendar/cicd/sender/Dockerfile
 rename hw12_13_14_15_calendar/internal/api/private/{grpcserver.pb.go => private.pb.go} (82%)
 rename hw12_13_14_15_calendar/pkg/api/public/{grpcserver.pb.go => public.pb.go} (84%)
 rename hw12_13_14_15_calendar/pkg/api/public/{grpcserver.pb.gw.go => public.pb.gw.go} (99%)

diff --git a/.golangci.yml b/.golangci.yml
index edebcda..4e7fa91 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -16,4 +16,5 @@ linters:
     - gofumpt
     - gosec
     - nlreturn
-    - gocritic
\ No newline at end of file
+    - gocritic
+    - exhaustive
\ No newline at end of file
diff --git a/hw12_13_14_15_calendar/Makefile b/hw12_13_14_15_calendar/Makefile
index 08daa51..c3df0b2 100644
--- a/hw12_13_14_15_calendar/Makefile
+++ b/hw12_13_14_15_calendar/Makefile
@@ -19,12 +19,16 @@ install-lint-deps:
 	(which golangci-lint > /dev/null) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.30.0
 
 generate:
-	protoc  -I ./api/public  --go_out=plugins=grpc:./pkg/api/public --grpc-gateway_out=logtostderr=true:./pkg/api/public ./api/public/grpcserver.proto
-	protoc  -I ./api/private  --go_out=plugins=grpc:./internal/api/private ./api/private/grpcserver.proto
+	protoc  -I ./api/public  --go_out=plugins=grpc:./pkg/api/public --grpc-gateway_out=logtostderr=true:./pkg/api/public ./api/public/public.proto
+	protoc  -I ./api/private  --go_out=plugins=grpc:./internal/api/private ./api/private/private.proto
 
-rabbit-start:
-	sudo -S docker-compose -f ./cicd/docker-compose.yml up --build -d
-rabbit-stop:
+compose-build:
+	sudo -S docker-compose -f ./cicd/docker-compose.yml build
+
+compose-up:
+	sudo -S docker-compose -f ./cicd/docker-compose.yml up -d
+
+compose-down:
 	sudo -S docker-compose -f ./cicd/docker-compose.yml down
 
 calendar-start:
diff --git a/hw12_13_14_15_calendar/api/private/grpcserver.proto b/hw12_13_14_15_calendar/api/private/private.proto
similarity index 100%
rename from hw12_13_14_15_calendar/api/private/grpcserver.proto
rename to hw12_13_14_15_calendar/api/private/private.proto
diff --git a/hw12_13_14_15_calendar/api/public/grpcserver.proto b/hw12_13_14_15_calendar/api/public/public.proto
similarity index 100%
rename from hw12_13_14_15_calendar/api/public/grpcserver.proto
rename to hw12_13_14_15_calendar/api/public/public.proto
diff --git a/hw12_13_14_15_calendar/cicd/calendar/Dockerfile b/hw12_13_14_15_calendar/cicd/calendar/Dockerfile
new file mode 100644
index 0000000..c40664f
--- /dev/null
+++ b/hw12_13_14_15_calendar/cicd/calendar/Dockerfile
@@ -0,0 +1,28 @@
+FROM golang:1.14 as builder
+RUN mkdir -p /app
+WORKDIR /app
+COPY . .
+RUN go get -d ./cmd/calendar/.
+RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o calendar ./cmd/calendar/.
+
+FROM alpine:latest
+ENV APP_GRPC_ADDRESS=0.0.0.0
+ENV APP_GRPC_PORT=50051
+ENV APP_HTTP_ADDRESS=0.0.0.0
+ENV APP_HTTP_PORT=8888
+ENV APP_API_ADDRESS=0.0.0.0
+ENV APP_API_PORT=50053
+ENV APP_LOGGER_FILE=/calendar.log
+ENV APP_LOGGER_LEVEL=INFO
+ENV APP_STORAGE_INMEMORY=true
+ENV APP_STORAGE_SQLHOST=psql
+ENV APP_STORAGE_SQLPORT=5432
+ENV APP_STORAGE_SQLDBASE=calendar
+ENV APP_STORAGE_SQLUSER=calendar
+ENV APP_STORAGE_SQLPASS=12345678
+WORKDIR /
+COPY --from=builder /app/calendar ./sbin
+EXPOSE ${APP_GRPC_PORT}
+EXPOSE ${APP_HTTP_PORT}
+EXPOSE ${APP_API_PORT}
+CMD ["calendar"]
diff --git a/hw12_13_14_15_calendar/cicd/docker-compose.yml b/hw12_13_14_15_calendar/cicd/docker-compose.yml
index beb06ef..414b897 100644
--- a/hw12_13_14_15_calendar/cicd/docker-compose.yml
+++ b/hw12_13_14_15_calendar/cicd/docker-compose.yml
@@ -14,4 +14,26 @@ services:
       - "15672:15672"
     expose:
       - 5672
-      - 15672
\ No newline at end of file
+      - 15672
+  calendar:
+    build:
+      context: ..
+      dockerfile: ./cicd/calendar/Dockerfile
+    ports:
+      - 50051:50051
+      - 50053:50053
+      - 8888:8888
+    volumes:
+      - ../calendar.log:/calendar.log
+  scheduler:
+    build:
+      context: ..
+      dockerfile: ./cicd/scheduler/Dockerfile
+    volumes:
+      - ../calendar.log:/calendar.log
+  sender:
+    build:
+      context: ..
+      dockerfile: ./cicd/sender/Dockerfile
+    volumes:
+      - ../calendar.log:/calendar.log
\ No newline at end of file
diff --git a/hw12_13_14_15_calendar/cicd/scheduler/Dockerfile b/hw12_13_14_15_calendar/cicd/scheduler/Dockerfile
new file mode 100644
index 0000000..a7a1c23
--- /dev/null
+++ b/hw12_13_14_15_calendar/cicd/scheduler/Dockerfile
@@ -0,0 +1,22 @@
+FROM golang:1.14 as builder
+RUN mkdir -p /app
+WORKDIR /app
+COPY . .
+RUN go get -d ./cmd/scheduler/.
+RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o scheduler ./cmd/scheduler/.
+
+FROM alpine:latest
+ENV APP_RABBITMQ_ADDRESS=rabbitmq
+ENV APP_RABBITMQ_PORT=5672
+ENV APP_RABBITMQ_LOGIN=rabbit
+ENV APP_RABBITMQ_PASS=rabbit
+ENV APP_RABBITMQ_EXCHANGE=calendar
+ENV APP_RABBITMQ_QUEUE=notifications
+ENV APP_RABBITMQ_KEY=events
+ENV APP_API_ADDRESS=calendar
+ENV APP_API_PORT=50053
+ENV APP_LOGGER_FILE=/calendar.log
+ENV APP_LOGGER_LEVEL=INFO
+WORKDIR /
+COPY --from=builder /app/scheduler ./sbin
+CMD ["scheduler"]
diff --git a/hw12_13_14_15_calendar/cicd/sender/Dockerfile b/hw12_13_14_15_calendar/cicd/sender/Dockerfile
new file mode 100644
index 0000000..a4345ea
--- /dev/null
+++ b/hw12_13_14_15_calendar/cicd/sender/Dockerfile
@@ -0,0 +1,20 @@
+FROM golang:1.14 as builder
+RUN mkdir -p /app
+WORKDIR /app
+COPY . .
+RUN go get -d ./cmd/sender/.
+RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o sender ./cmd/sender/.
+
+FROM alpine:latest
+ENV APP_RABBITMQ_ADDRESS=rabbitmq
+ENV APP_RABBITMQ_PORT=5672
+ENV APP_RABBITMQ_LOGIN=rabbit
+ENV APP_RABBITMQ_PASS=rabbit
+ENV APP_RABBITMQ_EXCHANGE=calendar
+ENV APP_RABBITMQ_QUEUE=notifications
+ENV APP_RABBITMQ_KEY=events
+ENV APP_LOGGER_FILE=/calendar.log
+ENV APP_LOGGER_LEVEL=INFO
+WORKDIR /
+COPY --from=builder /app/sender ./sbin
+CMD ["sender"]
diff --git a/hw12_13_14_15_calendar/cmd/calendar/main.go b/hw12_13_14_15_calendar/cmd/calendar/main.go
index 182c864..c7fedd3 100644
--- a/hw12_13_14_15_calendar/cmd/calendar/main.go
+++ b/hw12_13_14_15_calendar/cmd/calendar/main.go
@@ -24,7 +24,7 @@ import (
 var configFile string
 
 func init() {
-	flag.StringVar(&configFile, "config", "/etc/calendar.conf", "Path to configuration file")
+	flag.StringVar(&configFile, "config", "", "Path to configuration file")
 	flag.Parse()
 }
 
@@ -34,19 +34,14 @@ func main() {
 	if err != nil {
 		oslog.Fatal("не удалось открыть файл конфигурации:", err.Error())
 	}
+	oslog.Printf("Переменная APP_GRPC_PORT: %#v", os.Getenv("APP_GRPC_PORT"))
+	oslog.Printf("Конфиг приложения: %#v", conf)
 	log, err := logger.New(logger.Config(conf.Logger))
 	if err != nil {
 		oslog.Fatal("не удалось запустить логер:", err.Error())
 	}
-	storeConf := store.Config{
-		InMemory: conf.Storage.InMemory,
-		SQLHost:  conf.Storage.SQLHost,
-		SQLPort:  conf.Storage.SQLPort,
-		SQLDbase: conf.Storage.SQLDbase,
-		SQLUser:  conf.Storage.SQLUser,
-		SQLPass:  conf.Storage.SQLPass,
-	}
-	st := store.NewStore(storeConf)
+
+	st := store.NewStore(store.Config(conf.Storage))
 
 	calendar := calendar.New(log, st)
 
@@ -83,7 +78,7 @@ func main() {
 	mux := http.NewServeMux()
 	mux.Handle("/", grpcGwRouter)
 	go func() {
-		log.Infof("start webAPI server")
+		log.Infof("webAPI server starting")
 		if err := http.ListenAndServe(net.JoinHostPort(conf.HTTP.Address, conf.HTTP.Port), mux); err != nil {
 			log.Errorf("failed to start webAPI server: " + err.Error())
 			os.Exit(1)
diff --git a/hw12_13_14_15_calendar/cmd/scheduler/main.go b/hw12_13_14_15_calendar/cmd/scheduler/main.go
index 5793fc3..bc9fae4 100644
--- a/hw12_13_14_15_calendar/cmd/scheduler/main.go
+++ b/hw12_13_14_15_calendar/cmd/scheduler/main.go
@@ -16,7 +16,7 @@ import (
 var configFile string
 
 func init() {
-	flag.StringVar(&configFile, "config", "/etc/scheduler.conf", "Path to configuration file")
+	flag.StringVar(&configFile, "config", "", "Path to configuration file")
 	flag.Parse()
 }
 
diff --git a/hw12_13_14_15_calendar/configs/calendar.conf b/hw12_13_14_15_calendar/configs/calendar.conf
index e787d79..21dc460 100644
--- a/hw12_13_14_15_calendar/configs/calendar.conf
+++ b/hw12_13_14_15_calendar/configs/calendar.conf
@@ -1,13 +1,13 @@
 [Grpc]
-Address = "localhost"
+Address = "0.0.0.0"
 Port = "50051"
 
 [HTTP]
-Address = "localhost"
+Address = "0.0.0.0"
 Port = "50052"
 
 [API]
-Address = "localhost"
+Address = "0.0.0.0"
 Port = "50053"
 
 [Logger]
diff --git a/hw12_13_14_15_calendar/go.mod b/hw12_13_14_15_calendar/go.mod
index aa61bd3..d78efb5 100644
--- a/hw12_13_14_15_calendar/go.mod
+++ b/hw12_13_14_15_calendar/go.mod
@@ -9,8 +9,9 @@ require (
 	github.com/golang/protobuf v1.4.2
 	github.com/grpc-ecosystem/grpc-gateway v1.15.0
 	github.com/kr/text v0.2.0 // indirect
+	github.com/mxschmitt/golang-env-struct v0.0.0-20181017075525-0c54aeca8397
 	github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
-	github.com/pkg/errors v0.9.1 // indirect
+	github.com/pkg/errors v0.9.1
 	github.com/sirupsen/logrus v1.4.2 // indirect
 	github.com/streadway/amqp v1.0.0
 	github.com/stretchr/testify v1.6.1
diff --git a/hw12_13_14_15_calendar/go.sum b/hw12_13_14_15_calendar/go.sum
index 9358aa9..8061704 100644
--- a/hw12_13_14_15_calendar/go.sum
+++ b/hw12_13_14_15_calendar/go.sum
@@ -54,6 +54,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
 github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/mxschmitt/golang-env-struct v0.0.0-20181017075525-0c54aeca8397 h1:fbcg7+DIrrjxSsS78ARgJu/qZOO928w4mCj1KBEO7xM=
+github.com/mxschmitt/golang-env-struct v0.0.0-20181017075525-0c54aeca8397/go.mod h1:BvJngicNxsNmAUzt7zXpaoWKwuBiyxnD7DxzxfrrPyY=
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
 github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
diff --git a/hw12_13_14_15_calendar/internal/api/private/grpcserver.pb.go b/hw12_13_14_15_calendar/internal/api/private/private.pb.go
similarity index 82%
rename from hw12_13_14_15_calendar/internal/api/private/grpcserver.pb.go
rename to hw12_13_14_15_calendar/internal/api/private/private.pb.go
index bcaad71..601fedf 100644
--- a/hw12_13_14_15_calendar/internal/api/private/grpcserver.pb.go
+++ b/hw12_13_14_15_calendar/internal/api/private/private.pb.go
@@ -1,5 +1,5 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
-// source: grpcserver.proto
+// source: private.proto
 
 package private
 
@@ -37,7 +37,7 @@ func (m *GetRsp) Reset()         { *m = GetRsp{} }
 func (m *GetRsp) String() string { return proto.CompactTextString(m) }
 func (*GetRsp) ProtoMessage()    {}
 func (*GetRsp) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{0}
+	return fileDescriptor_d2a91b51c7bdc125, []int{0}
 }
 
 func (m *GetRsp) XXX_Unmarshal(b []byte) error {
@@ -76,7 +76,7 @@ func (m *SetReq) Reset()         { *m = SetReq{} }
 func (m *SetReq) String() string { return proto.CompactTextString(m) }
 func (*SetReq) ProtoMessage()    {}
 func (*SetReq) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{1}
+	return fileDescriptor_d2a91b51c7bdc125, []int{1}
 }
 
 func (m *SetReq) XXX_Unmarshal(b []byte) error {
@@ -115,7 +115,7 @@ func (m *PurgeReq) Reset()         { *m = PurgeReq{} }
 func (m *PurgeReq) String() string { return proto.CompactTextString(m) }
 func (*PurgeReq) ProtoMessage()    {}
 func (*PurgeReq) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{2}
+	return fileDescriptor_d2a91b51c7bdc125, []int{2}
 }
 
 func (m *PurgeReq) XXX_Unmarshal(b []byte) error {
@@ -154,7 +154,7 @@ func (m *PurgeResp) Reset()         { *m = PurgeResp{} }
 func (m *PurgeResp) String() string { return proto.CompactTextString(m) }
 func (*PurgeResp) ProtoMessage()    {}
 func (*PurgeResp) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{3}
+	return fileDescriptor_d2a91b51c7bdc125, []int{3}
 }
 
 func (m *PurgeResp) XXX_Unmarshal(b []byte) error {
@@ -196,7 +196,7 @@ func (m *Event) Reset()         { *m = Event{} }
 func (m *Event) String() string { return proto.CompactTextString(m) }
 func (*Event) ProtoMessage()    {}
 func (*Event) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{4}
+	return fileDescriptor_d2a91b51c7bdc125, []int{4}
 }
 
 func (m *Event) XXX_Unmarshal(b []byte) error {
@@ -253,32 +253,32 @@ func init() {
 	proto.RegisterType((*Event)(nil), "private.Event")
 }
 
-func init() { proto.RegisterFile("grpcserver.proto", fileDescriptor_afa6debe97205904) }
+func init() { proto.RegisterFile("private.proto", fileDescriptor_d2a91b51c7bdc125) }
 
-var fileDescriptor_afa6debe97205904 = []byte{
-	// 351 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x6b, 0xea, 0x50,
-	0x10, 0x85, 0x8d, 0xd1, 0xbc, 0xe7, 0xc8, 0xf3, 0xf9, 0x86, 0x87, 0x84, 0x94, 0xd2, 0x10, 0x4a,
-	0xc9, 0x2a, 0x8a, 0xdd, 0xb4, 0x8b, 0x6e, 0x4a, 0x44, 0xdc, 0xd4, 0x36, 0xda, 0x4d, 0x77, 0x51,
-	0xc7, 0x34, 0x10, 0x4d, 0x7a, 0xef, 0x28, 0xf8, 0xd7, 0xfa, 0xeb, 0x4a, 0x72, 0x13, 0x4b, 0x2d,
-	0xdd, 0xe5, 0x9e, 0x39, 0x73, 0x0e, 0xf3, 0x11, 0xe8, 0x46, 0x22, 0x5b, 0x4a, 0x12, 0x7b, 0x12,
-	0x5e, 0x26, 0x52, 0x4e, 0xf1, 0x57, 0x26, 0xe2, 0x7d, 0xc8, 0x64, 0x5d, 0x44, 0x69, 0x1a, 0x25,
-	0xd4, 0x2f, 0xe4, 0xc5, 0x6e, 0xdd, 0xe7, 0x78, 0x43, 0x92, 0xc3, 0x4d, 0xa6, 0x9c, 0xd6, 0xd9,
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 0x35, 0xbc, 0x81, 0xf6, 0xac, 0x5a, 0xa7, 0x15, 0x7e, 0x3a, 0x14, 0x3f,
-	0xeb, 0x87, 0x28, 0xa7, 0x86, 0xb7, 0xd0, 0x29, 0xb8, 0x4c, 0x93, 0x95, 0xa2, 0x8e, 0xff, 0x8e,
-	0xcb, 0x15, 0x62, 0x0b, 0x4f, 0xa5, 0xbc, 0xf4, 0xbe, 0xf5, 0x52, 0xfd, 0x19, 0x0b, 0xa3, 0xc8,
-	0xbd, 0xfe, 0x08, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xac, 0x01, 0x89, 0x3d, 0x02, 0x00, 0x00,
+var fileDescriptor_d2a91b51c7bdc125 = []byte{
+	// 343 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x4f, 0xc2, 0x50,
+	0x10, 0x84, 0x29, 0x85, 0x2a, 0x4b, 0x40, 0xdc, 0x18, 0xd2, 0xd4, 0x18, 0x9b, 0xc6, 0x98, 0x9e,
+	0x0a, 0xc1, 0x8b, 0x1e, 0xbc, 0x98, 0x12, 0xc2, 0x45, 0xb4, 0xe0, 0xc5, 0x5b, 0x81, 0xa5, 0x36,
+	0x29, 0xb4, 0xb6, 0x0b, 0x09, 0x7f, 0xcd, 0x5f, 0x67, 0xfa, 0x5e, 0x8b, 0x11, 0xe3, 0xad, 0x3b,
+	0x3b, 0x3b, 0x93, 0xf7, 0xa5, 0xd0, 0x4a, 0xd2, 0x70, 0xe7, 0x33, 0x39, 0x49, 0x1a, 0x73, 0x8c,
+	0x27, 0xc5, 0x68, 0x5c, 0x07, 0x71, 0x1c, 0x44, 0xd4, 0x13, 0xf2, 0x7c, 0xbb, 0xea, 0x71, 0xb8,
+	0xa6, 0x8c, 0xfd, 0x75, 0x22, 0x9d, 0xc6, 0xe5, 0xb1, 0x81, 0xd6, 0x09, 0xef, 0xe5, 0xd2, 0xea,
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cb, 0x73, 0x5a, 0xe2, 0x8f, 0x43, 0xf2, 0x33, 0xfe, 0x89, 0xb2, 0x2a, 0xf8, 0x00, 0x6d,
+	0xc1, 0x65, 0x12, 0x2d, 0x25, 0x75, 0x3c, 0x3f, 0x1c, 0x97, 0x88, 0x0d, 0x3c, 0x96, 0xf2, 0xd2,
+	0xa7, 0xc6, 0x7b, 0xf9, 0x67, 0xcc, 0x35, 0x91, 0x7b, 0xf7, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x2d,
+	0x9f, 0xdc, 0xae, 0x3a, 0x02, 0x00, 0x00,
 }
 
 // Reference imports to suppress errors if they are not otherwise used.
@@ -430,5 +430,5 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{
 		},
 	},
 	Streams:  []grpc.StreamDesc{},
-	Metadata: "grpcserver.proto",
+	Metadata: "private.proto",
 }
diff --git a/hw12_13_14_15_calendar/internal/api/private/server.go b/hw12_13_14_15_calendar/internal/api/private/server.go
index 1c857f6..6a0a2ba 100644
--- a/hw12_13_14_15_calendar/internal/api/private/server.go
+++ b/hw12_13_14_15_calendar/internal/api/private/server.go
@@ -22,7 +22,7 @@ func New(app *calendar.App) Server {
 }
 
 func (s *Server) Start(conf Config) error {
-	s.app.Logger.Infof("GRPC server starting")
+	s.app.Logger.Infof("private GRPC server starting")
 	listnGrpc, err := net.Listen("tcp", net.JoinHostPort(conf.Address, conf.Port))
 	RegisterGrpcServer(s.s, &Service{})
 	if err != nil {
diff --git a/hw12_13_14_15_calendar/pkg/api/public/grpcserver.pb.go b/hw12_13_14_15_calendar/pkg/api/public/public.pb.go
similarity index 84%
rename from hw12_13_14_15_calendar/pkg/api/public/grpcserver.pb.go
rename to hw12_13_14_15_calendar/pkg/api/public/public.pb.go
index b595e75..e9ecd62 100644
--- a/hw12_13_14_15_calendar/pkg/api/public/grpcserver.pb.go
+++ b/hw12_13_14_15_calendar/pkg/api/public/public.pb.go
@@ -1,5 +1,5 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
-// source: grpcserver.proto
+// source: public.proto
 
 package public
 
@@ -53,7 +53,7 @@ func (x QueryRange) String() string {
 }
 
 func (QueryRange) EnumDescriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{0}
+	return fileDescriptor_413a91106d7bcce8, []int{0}
 }
 
 type Event struct {
@@ -73,7 +73,7 @@ func (m *Event) Reset()         { *m = Event{} }
 func (m *Event) String() string { return proto.CompactTextString(m) }
 func (*Event) ProtoMessage()    {}
 func (*Event) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{0}
+	return fileDescriptor_413a91106d7bcce8, []int{0}
 }
 
 func (m *Event) XXX_Unmarshal(b []byte) error {
@@ -159,7 +159,7 @@ func (m *CreateReq) Reset()         { *m = CreateReq{} }
 func (m *CreateReq) String() string { return proto.CompactTextString(m) }
 func (*CreateReq) ProtoMessage()    {}
 func (*CreateReq) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{1}
+	return fileDescriptor_413a91106d7bcce8, []int{1}
 }
 
 func (m *CreateReq) XXX_Unmarshal(b []byte) error {
@@ -233,7 +233,7 @@ func (m *CreateRsp) Reset()         { *m = CreateRsp{} }
 func (m *CreateRsp) String() string { return proto.CompactTextString(m) }
 func (*CreateRsp) ProtoMessage()    {}
 func (*CreateRsp) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{2}
+	return fileDescriptor_413a91106d7bcce8, []int{2}
 }
 
 func (m *CreateRsp) XXX_Unmarshal(b []byte) error {
@@ -273,7 +273,7 @@ func (m *UpdateReq) Reset()         { *m = UpdateReq{} }
 func (m *UpdateReq) String() string { return proto.CompactTextString(m) }
 func (*UpdateReq) ProtoMessage()    {}
 func (*UpdateReq) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{3}
+	return fileDescriptor_413a91106d7bcce8, []int{3}
 }
 
 func (m *UpdateReq) XXX_Unmarshal(b []byte) error {
@@ -319,7 +319,7 @@ func (m *DeleteReq) Reset()         { *m = DeleteReq{} }
 func (m *DeleteReq) String() string { return proto.CompactTextString(m) }
 func (*DeleteReq) ProtoMessage()    {}
 func (*DeleteReq) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{4}
+	return fileDescriptor_413a91106d7bcce8, []int{4}
 }
 
 func (m *DeleteReq) XXX_Unmarshal(b []byte) error {
@@ -358,7 +358,7 @@ func (m *ListResp) Reset()         { *m = ListResp{} }
 func (m *ListResp) String() string { return proto.CompactTextString(m) }
 func (*ListResp) ProtoMessage()    {}
 func (*ListResp) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{5}
+	return fileDescriptor_413a91106d7bcce8, []int{5}
 }
 
 func (m *ListResp) XXX_Unmarshal(b []byte) error {
@@ -397,7 +397,7 @@ func (m *GetByIDReq) Reset()         { *m = GetByIDReq{} }
 func (m *GetByIDReq) String() string { return proto.CompactTextString(m) }
 func (*GetByIDReq) ProtoMessage()    {}
 func (*GetByIDReq) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{6}
+	return fileDescriptor_413a91106d7bcce8, []int{6}
 }
 
 func (m *GetByIDReq) XXX_Unmarshal(b []byte) error {
@@ -436,7 +436,7 @@ func (m *GetByIDResp) Reset()         { *m = GetByIDResp{} }
 func (m *GetByIDResp) String() string { return proto.CompactTextString(m) }
 func (*GetByIDResp) ProtoMessage()    {}
 func (*GetByIDResp) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{7}
+	return fileDescriptor_413a91106d7bcce8, []int{7}
 }
 
 func (m *GetByIDResp) XXX_Unmarshal(b []byte) error {
@@ -476,7 +476,7 @@ func (m *GetByDateReq) Reset()         { *m = GetByDateReq{} }
 func (m *GetByDateReq) String() string { return proto.CompactTextString(m) }
 func (*GetByDateReq) ProtoMessage()    {}
 func (*GetByDateReq) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{8}
+	return fileDescriptor_413a91106d7bcce8, []int{8}
 }
 
 func (m *GetByDateReq) XXX_Unmarshal(b []byte) error {
@@ -522,7 +522,7 @@ func (m *GetByDateResp) Reset()         { *m = GetByDateResp{} }
 func (m *GetByDateResp) String() string { return proto.CompactTextString(m) }
 func (*GetByDateResp) ProtoMessage()    {}
 func (*GetByDateResp) Descriptor() ([]byte, []int) {
-	return fileDescriptor_afa6debe97205904, []int{9}
+	return fileDescriptor_413a91106d7bcce8, []int{9}
 }
 
 func (m *GetByDateResp) XXX_Unmarshal(b []byte) error {
@@ -564,49 +564,48 @@ func init() {
 	proto.RegisterType((*GetByDateResp)(nil), "public.GetByDateResp")
 }
 
-func init() { proto.RegisterFile("grpcserver.proto", fileDescriptor_afa6debe97205904) }
+func init() { proto.RegisterFile("public.proto", fileDescriptor_413a91106d7bcce8) }
 
-var fileDescriptor_afa6debe97205904 = []byte{
-	// 613 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x95, 0xcb, 0x6e, 0xd3, 0x5c,
-	0x10, 0xc7, 0x3f, 0x27, 0x8e, 0x53, 0x4f, 0x2f, 0x5f, 0x3a, 0x94, 0x62, 0xdc, 0xaa, 0x44, 0x07,
-	0x21, 0x45, 0x59, 0xd8, 0x22, 0x45, 0x48, 0xb0, 0xa2, 0xc5, 0x11, 0xb5, 0x28, 0x45, 0x58, 0xa9,
-	0xb8, 0xec, 0x9c, 0xf4, 0x34, 0x58, 0x4a, 0xec, 0x83, 0x7d, 0x52, 0x29, 0xaa, 0xb2, 0xe1, 0x15,
-	0x78, 0x2b, 0xb6, 0xbc, 0x02, 0x5b, 0x1e, 0x80, 0x1d, 0xf2, 0xf1, 0xb1, 0xd3, 0x5c, 0x2a, 0xb2,
-	0x67, 0x17, 0xcf, 0x7f, 0xe6, 0x37, 0x33, 0x9e, 0xbf, 0x1c, 0xa8, 0xf5, 0x63, 0xd6, 0x4b, 0x68,
-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0xc1, 0xaf, 0x3f, 0x7e, 0x7e,
-	0x2b, 0x6d, 0x90, 0xaa, 0x4d, 0x45, 0xd7, 0xe7, 0x4a, 0x13, 0x4f, 0x41, 0xcb, 0x0c, 0x30, 0x65,
-	0x14, 0x86, 0x30, 0x77, 0x17, 0xde, 0x4c, 0x3b, 0xfd, 0xc4, 0x90, 0x7b, 0x02, 0xb4, 0x6d, 0x6e,
-	0x48, 0x90, 0x7d, 0xed, 0x3a, 0x93, 0x94, 0xe6, 0x82, 0x96, 0x99, 0x61, 0x4a, 0x2b, 0xcc, 0x71,
-	0x2b, 0x6d, 0x47, 0xd0, 0xb6, 0x9a, 0x33, 0x34, 0x3c, 0x02, 0x35, 0xb5, 0x0e, 0xde, 0x52, 0x65,
-	0xd6, 0xf2, 0x06, 0xb9, 0xc1, 0xc8, 0xff, 0x82, 0xa3, 0x63, 0xbe, 0x1e, 0x9e, 0x40, 0x55, 0x9a,
-	0x05, 0x8b, 0x93, 0x4d, 0xbd, 0x65, 0xde, 0x59, 0x88, 0x25, 0x2c, 0x1f, 0x06, 0x67, 0x87, 0xf9,
-	0x00, 0x7a, 0x71, 0x56, 0xdc, 0x99, 0xa9, 0x93, 0x9e, 0x32, 0xef, 0x2e, 0x89, 0x26, 0x8c, 0x1c,
-	0x08, 0x9e, 0x41, 0x76, 0x0b, 0x9e, 0x38, 0xf1, 0xc4, 0xbe, 0x4e, 0x53, 0x26, 0xc7, 0x6b, 0x9f,
-	0xe4, 0xff, 0x41, 0x57, 0x13, 0x0b, 0x1e, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x88, 0xff, 0xa1,
-	0x0a, 0x32, 0x06, 0x00, 0x00,
+var fileDescriptor_413a91106d7bcce8 = []byte{
+	// 606 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x95, 0xcd, 0x6e, 0xd3, 0x40,
+	0x10, 0xc7, 0x71, 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9e,
+	0xf4, 0x94, 0x79, 0x77, 0xc9, 0x6d, 0xc2, 0xc8, 0xbe, 0xe0, 0x19, 0x64, 0xa7, 0xe0, 0x89, 0x15,
+	0x4f, 0xec, 0xab, 0x34, 0x64, 0x72, 0xb4, 0xf6, 0x49, 0x7e, 0x0f, 0xba, 0x9a, 0x18, 0xf0, 0xe0,
+	0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x37, 0x8b, 0x96, 0x2e, 0x06, 0x00, 0x00,
 }
 
 // Reference imports to suppress errors if they are not otherwise used.
@@ -866,5 +865,5 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{
 		},
 	},
 	Streams:  []grpc.StreamDesc{},
-	Metadata: "grpcserver.proto",
+	Metadata: "public.proto",
 }
diff --git a/hw12_13_14_15_calendar/pkg/api/public/grpcserver.pb.gw.go b/hw12_13_14_15_calendar/pkg/api/public/public.pb.gw.go
similarity index 99%
rename from hw12_13_14_15_calendar/pkg/api/public/grpcserver.pb.gw.go
rename to hw12_13_14_15_calendar/pkg/api/public/public.pb.gw.go
index a86236c..281320c 100644
--- a/hw12_13_14_15_calendar/pkg/api/public/grpcserver.pb.gw.go
+++ b/hw12_13_14_15_calendar/pkg/api/public/public.pb.gw.go
@@ -1,5 +1,5 @@
 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
-// source: grpcserver.proto
+// source: public.proto
 
 /*
 Package public is a reverse proxy.
diff --git a/hw12_13_14_15_calendar/pkg/api/public/server.go b/hw12_13_14_15_calendar/pkg/api/public/server.go
index 1d88db1..c0b8cc2 100644
--- a/hw12_13_14_15_calendar/pkg/api/public/server.go
+++ b/hw12_13_14_15_calendar/pkg/api/public/server.go
@@ -18,7 +18,7 @@ func New(app *calendar.App) Server {
 }
 
 func (s *Server) Start(conf config.Calendar) error {
-	s.app.Logger.Infof("GRPC server starting")
+	s.app.Logger.Infof("public GRPC server starting")
 	listnGrpc, err := net.Listen("tcp", net.JoinHostPort(conf.GRPC.Address, conf.GRPC.Port))
 	RegisterGrpcServer(s.s, &Service{})
 	if err != nil {
diff --git a/hw12_13_14_15_calendar/pkg/config/config.go b/hw12_13_14_15_calendar/pkg/config/config.go
index 4945f71..67e0894 100644
--- a/hw12_13_14_15_calendar/pkg/config/config.go
+++ b/hw12_13_14_15_calendar/pkg/config/config.go
@@ -3,11 +3,18 @@ package config
 import (
 	"io/ioutil"
 	"os"
+	"reflect"
+	"strconv"
+	"strings"
 
 	"github.com/BurntSushi/toml"
+	"github.com/pkg/errors"
 )
 
 func New(configFile string, str interface{}) error {
+	if configFile == "" {
+		return ApplyEnvVars(str, "APP")
+	}
 	f, err := os.Open(configFile)
 	if err != nil {
 		return err
@@ -18,5 +25,53 @@ func New(configFile string, str interface{}) error {
 		return err
 	}
 	_, err = toml.Decode(string(s), str)
-	return err
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// Пришлось немного модифицировать пакет github.com/mxschmitt/golang-env-struct. В исходной реализации используется поиск по тегам, а у моих структур тегов быть не должно. Пришлось переделать функцию, чтобы она искала по именам полей.
+// Тест дополнен проверкой заполнения структуры из переменных окружения.
+func ApplyEnvVars(c interface{}, prefix string) error {
+	return applyEnvVar(reflect.ValueOf(c), reflect.TypeOf(c), -1, prefix)
+}
+
+func applyEnvVar(v reflect.Value, t reflect.Type, counter int, prefix string) error {
+	if v.Kind() != reflect.Ptr {
+		return errors.New("not a pointer value")
+	}
+	f := reflect.StructField{}
+	if counter != -1 {
+		f = t.Field(counter)
+	}
+	v = reflect.Indirect(v)
+	fName := strings.ToUpper(f.Name)
+	env := os.Getenv(prefix + fName)
+	if env != "" {
+		switch v.Kind() {
+		case reflect.Int:
+			envI, err := strconv.Atoi(env)
+			if err != nil {
+				return errors.Wrap(err, "could not parse to int")
+			}
+			v.SetInt(int64(envI))
+		case reflect.String:
+			v.SetString(env)
+		case reflect.Bool:
+			envB, err := strconv.ParseBool(env)
+			if err != nil {
+				return errors.Wrap(err, "could not parse bool")
+			}
+			v.SetBool(envB)
+		}
+	}
+	if v.Kind() == reflect.Struct {
+		for i := 0; i < v.NumField(); i++ {
+			if err := applyEnvVar(v.Field(i).Addr(), v.Type(), i, prefix+fName+"_"); err != nil {
+				return errors.Wrap(err, "could not apply env var")
+			}
+		}
+	}
+	return nil
 }
diff --git a/hw12_13_14_15_calendar/pkg/config/config_test.go b/hw12_13_14_15_calendar/pkg/config/config_test.go
index cff5012..ff2acba 100644
--- a/hw12_13_14_15_calendar/pkg/config/config_test.go
+++ b/hw12_13_14_15_calendar/pkg/config/config_test.go
@@ -58,4 +58,33 @@ SQLHost = "localhost"`)
 		require.NoError(t, e)
 	})
 
+	t.Run("ENV reading", func(t *testing.T) {
+		for k, v := range map[string]string{"APP_STRUCT1_VAR1": "val1", "APP_STRUCT1_VAR2": "val2", "APP_STRUCT2_VAR1": "val3", "APP_STRUCT2_VAR2": "val4", "APP_STRUCT3_VAR1": "val5", "APP_STRUCT3_VAR2": "val6"} {
+			require.NoError(t, os.Setenv(k, v))
+		}
+		var str struct {
+			Struct1 struct {
+				Var1 string
+				Var2 string
+			}
+			Struct2 struct {
+				Var1 string
+				Var2 string
+			}
+			Struct3 struct {
+				Var1 string
+				Var2 string
+			}
+		}
+
+		err := New("", &str)
+		require.NoError(t, err)
+		require.Equal(t, "val1", str.Struct1.Var1)
+		require.Equal(t, "val2", str.Struct1.Var2)
+		require.Equal(t, "val3", str.Struct2.Var1)
+		require.Equal(t, "val4", str.Struct2.Var2)
+		require.Equal(t, "val5", str.Struct3.Var1)
+		require.Equal(t, "val6", str.Struct3.Var2)
+	})
+
 }
diff --git a/hw12_13_14_15_calendar/pkg/logger/logger.go b/hw12_13_14_15_calendar/pkg/logger/logger.go
index c9fdfca..7cb4da9 100644
--- a/hw12_13_14_15_calendar/pkg/logger/logger.go
+++ b/hw12_13_14_15_calendar/pkg/logger/logger.go
@@ -48,6 +48,7 @@ func New(conf Config) (Interface, error) {
 		log.Fatalf("Could not instantiate log %s", err.Error())
 	}
 	l := amitralog.WithFields(amitralog.Fields{"hw": "12"})
+	l.Infof("logger start successful")
 	return l, nil
 }