Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
chore: print config
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Jun 1, 2021
1 parent c022a49 commit 0125aad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .env

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -23,6 +23,7 @@ __debug_bin
/bin
/debug
/mongo
.env.local
/.env
/.env.local
/coverage.txt
/web
13 changes: 13 additions & 0 deletions internal/app/config.go
@@ -1,7 +1,9 @@
package app

import (
"fmt"
"os"
"strings"

"github.com/joho/godotenv"
"github.com/kelseyhightower/envconfig"
Expand Down Expand Up @@ -58,3 +60,14 @@ func ReadConfig(debug bool) (*Config, error) {

return &c, err
}

func (c Config) Print() string {
s := fmt.Sprintf("%+v", c)
for _, secret := range []string{c.DB, c.Auth0.ClientSecret} {
if secret == "" {
continue
}
s = strings.ReplaceAll(s, secret, "***")
}
return s
}
1 change: 1 addition & 0 deletions internal/app/main.go
Expand Up @@ -16,6 +16,7 @@ func Start(debug bool, version string) {
if cerr != nil {
log.Fatal(cerr)
}
log.Infof("config: %s", conf.Print())

// Init profiler
initProfiler(conf.Profiler, version)
Expand Down
3 changes: 0 additions & 3 deletions internal/usecase/interactor/user.go
Expand Up @@ -152,7 +152,6 @@ func (i *User) Signup(ctx context.Context, inp interfaces.SignupParam) (u *user.
}

func (i *User) UpdateMe(ctx context.Context, p interfaces.UpdateMeParam, operator *usecase.Operator) (u *user.User, err error) {

tx, err := i.transaction.Begin()
if err != nil {
return
Expand Down Expand Up @@ -242,7 +241,6 @@ func (i *User) UpdateMe(ctx context.Context, p interfaces.UpdateMeParam, operato
}

func (i *User) RemoveMyAuth(ctx context.Context, authProvider string, operator *usecase.Operator) (u *user.User, err error) {

tx, err := i.transaction.Begin()
if err != nil {
return
Expand Down Expand Up @@ -280,7 +278,6 @@ func (i *User) SearchUser(ctx context.Context, nameOrEmail string, operator *use
}

func (i *User) DeleteMe(ctx context.Context, userID id.UserID, operator *usecase.Operator) (err error) {

tx, err := i.transaction.Begin()
if err != nil {
return
Expand Down

0 comments on commit 0125aad

Please sign in to comment.