Skip to content

Commit d642b69

Browse files
committed
adjust title size
1 parent 6f4831a commit d642b69

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

config/config.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ func setFont() {
8282
}
8383
Font = f
8484
}
85+
86+
// AdjustFontSize adjust font size
87+
func (t *Text) AdjustTitleFontSize(text string) {
88+
if len(text) > 30 && len(text) < 34 {
89+
t.Size = 32
90+
} else if len(text) >= 34 && len(text) < 38 {
91+
t.Size = 30
92+
} else if len(text) >= 38 {
93+
t.Size = 28
94+
}
95+
}

external/github.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/po3rin/github_link_creator/entity"
1212
"github.com/po3rin/github_link_creator/lib/env"
13-
l "github.com/po3rin/github_link_creator/lib/logger"
1413

1514
"github.com/pkg/errors"
1615
)
@@ -19,7 +18,6 @@ var requestParams string
1918

2019
func init() {
2120
if env.GithubClientID == "" || env.GithubSecret == "" {
22-
l.Warn("not setted github client id or secret")
2321
requestParams = ""
2422
return
2523
}

lib/env/env.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package env
22

33
import (
44
"os"
5-
6-
l "github.com/po3rin/github_link_creator/lib/logger"
75
)
86

97
var (
@@ -34,26 +32,22 @@ func init() {
3432
port := os.Getenv("API_PORT")
3533
if port == "" {
3634
port = defaultPort
37-
l.Warnf("PORT environment is not exists. use default value %s", defaultPort)
3835
}
3936
Port = port
4037

4138
githubClientID := os.Getenv("GITHUB_CLIENT_ID")
4239
if githubClientID == "" {
43-
l.Warnf("GITHUB_CLIENT_ID environment is not exists.")
4440
}
4541
GithubClientID = githubClientID
4642

4743
githubSecret := os.Getenv("GITHUB_SECRET")
4844
if githubSecret == "" {
49-
l.Warnf("GITHUB_SECRET environment is not exists.")
5045
}
5146
GithubSecret = githubSecret
5247

5348
s3BucketName := os.Getenv("S3_BUCKET_NAME")
5449
if s3BucketName == "" {
5550
s3BucketName = defaultS3BucketName
56-
l.Warnf("S3_BUCKET_Name environment is not exists. use default value %s", defaultS3BucketName)
5751
}
5852
S3BucketName = s3BucketName
5953
}

pipeline/pipeline.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ func ProcessingImg(ctx context.Context, r Repoitory, userName string, repoName s
4040
return nil, err
4141
}
4242

43+
config.Title.AdjustTitleFontSize(repo.Name)
44+
4345
img, err = DrawText(synthesizedImg, config.Title, repo.Name)
4446
if err != nil {
4547
l.Error(err)

0 commit comments

Comments
 (0)