diff --git a/internal/domain/config.go b/internal/domain/config.go index 26411f1..f91cf65 100644 --- a/internal/domain/config.go +++ b/internal/domain/config.go @@ -48,7 +48,8 @@ type TelegramConfig struct { } type DiscordConfig struct { - Token string + Token string + ProjectsChannelID string } type ApplicationConfig struct { @@ -92,7 +93,8 @@ func InitConfig(envFilePath string) Config { Token: os.Getenv("TG_API"), }, Discord: DiscordConfig{ - Token: os.Getenv("DISCORD_TOKEN"), + Token: os.Getenv("DISCORD_TOKEN"), + ProjectsChannelID: os.Getenv("PROJECTS_CHANNEL_GROUP"), }, } } diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go index 9c600e0..4dc555a 100644 --- a/internal/helpers/helpers.go +++ b/internal/helpers/helpers.go @@ -7,7 +7,7 @@ import ( "strings" ) -func ValidNaming(input string) string { +func Cut(input string) string { // Remove leading and trailing whitespace input = strings.TrimSpace(input) diff --git a/internal/helpers/helpers_test.go b/internal/helpers/helpers_test.go index 53e8112..2c08798 100644 --- a/internal/helpers/helpers_test.go +++ b/internal/helpers/helpers_test.go @@ -18,7 +18,7 @@ var tests = []test{ func TestGitNaming(t *testing.T) { for _, test := range tests { - if output := ValidNaming(test.arg); output != test.expected { + if output := Cut(test.arg); output != test.expected { t.Errorf("Output %q not equal to expected %q", output, test.expected) } } diff --git a/internal/services/cloud.go b/internal/services/cloud.go index cd37732..b5a748e 100644 --- a/internal/services/cloud.go +++ b/internal/services/cloud.go @@ -49,7 +49,7 @@ func (c *Cloud) CreateFolder(name string) Response { davPath := "/remote.php/dav/files/" parentPath := "/apps/files/?dir=" - name = helpers.ValidNaming(name) + name = helpers.Cut(name) R.Folder = &domain.Folder{ Title: name, diff --git a/internal/services/git.go b/internal/services/git.go index 0f1c1a7..b3c86ba 100644 --- a/internal/services/git.go +++ b/internal/services/git.go @@ -55,7 +55,7 @@ type gitCreateRequest struct { } func (gb *Git) newRepo(name string) (*domain.Git, error) { - name = helpers.ValidNaming(name) + name = helpers.Cut(name) payload := gitCreateRequest{ Name: name,