summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go3
-rw-r--r--internal/config/config_test.go27
2 files changed, 3 insertions, 27 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 6d2e2ef..f4baeef 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -9,7 +9,6 @@ import (
// Config holds all application configuration
type Config struct {
// API Keys
- TodoistAPIKey string
PlanToEatAPIKey string
PlanToEatSession string // Session cookie for web scraping
TrelloAPIKey string
@@ -56,7 +55,6 @@ type Config struct {
func Load() (*Config, error) {
cfg := &Config{
// API Keys
- TodoistAPIKey: os.Getenv("TODOIST_API_KEY"),
PlanToEatAPIKey: os.Getenv("PLANTOEAT_API_KEY"),
PlanToEatSession: os.Getenv("PLANTOEAT_SESSION"),
TrelloAPIKey: os.Getenv("TRELLO_API_KEY"),
@@ -109,7 +107,6 @@ func Load() (*Config, error) {
// Validate checks that required configuration is present
func (c *Config) Validate() error {
- // Todoist is optional — native task management replaces it when key is absent
if c.TrelloAPIKey == "" {
return fmt.Errorf("TRELLO_API_KEY is required")
}
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 0722825..b436e93 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -15,33 +15,22 @@ func TestConfigValidate(t *testing.T) {
{
name: "valid config",
cfg: Config{
- TodoistAPIKey: "todoist-key",
- TrelloAPIKey: "trello-key",
- TrelloToken: "trello-token",
- },
- wantErr: false,
- },
- {
- name: "missing todoist key",
- cfg: Config{
TrelloAPIKey: "trello-key",
TrelloToken: "trello-token",
},
- wantErr: true,
+ wantErr: false,
},
{
name: "missing trello key",
cfg: Config{
- TodoistAPIKey: "todoist-key",
- TrelloToken: "trello-token",
+ TrelloToken: "trello-token",
},
wantErr: true,
},
{
name: "missing trello token",
cfg: Config{
- TodoistAPIKey: "todoist-key",
- TrelloAPIKey: "trello-key",
+ TrelloAPIKey: "trello-key",
},
wantErr: true,
},
@@ -242,14 +231,12 @@ func TestToDisplayTZ(t *testing.T) {
func TestLoad(t *testing.T) {
// Set up required env vars
- os.Setenv("TODOIST_API_KEY", "test-todoist-key")
os.Setenv("TRELLO_API_KEY", "test-trello-key")
os.Setenv("TRELLO_TOKEN", "test-trello-token")
os.Setenv("PORT", "9999")
os.Setenv("CACHE_TTL_MINUTES", "10")
os.Setenv("DEBUG", "true")
defer func() {
- os.Unsetenv("TODOIST_API_KEY")
os.Unsetenv("TRELLO_API_KEY")
os.Unsetenv("TRELLO_TOKEN")
os.Unsetenv("PORT")
@@ -262,9 +249,6 @@ func TestLoad(t *testing.T) {
t.Fatalf("Load failed: %v", err)
}
- if cfg.TodoistAPIKey != "test-todoist-key" {
- t.Errorf("Expected TodoistAPIKey 'test-todoist-key', got '%s'", cfg.TodoistAPIKey)
- }
if cfg.Port != "9999" {
t.Errorf("Expected Port '9999', got '%s'", cfg.Port)
}
@@ -278,11 +262,9 @@ func TestLoad(t *testing.T) {
func TestConfig_ClaudomatorURL_Default(t *testing.T) {
os.Unsetenv("CLAUDOMATOR_URL")
- os.Setenv("TODOIST_API_KEY", "test-todoist-key")
os.Setenv("TRELLO_API_KEY", "test-trello-key")
os.Setenv("TRELLO_TOKEN", "test-trello-token")
defer func() {
- os.Unsetenv("TODOIST_API_KEY")
os.Unsetenv("TRELLO_API_KEY")
os.Unsetenv("TRELLO_TOKEN")
}()
@@ -298,12 +280,10 @@ func TestConfig_ClaudomatorURL_Default(t *testing.T) {
func TestConfig_ClaudomatorURL_EnvOverride(t *testing.T) {
os.Setenv("CLAUDOMATOR_URL", "http://1.2.3.4:9000")
- os.Setenv("TODOIST_API_KEY", "test-todoist-key")
os.Setenv("TRELLO_API_KEY", "test-trello-key")
os.Setenv("TRELLO_TOKEN", "test-trello-token")
defer func() {
os.Unsetenv("CLAUDOMATOR_URL")
- os.Unsetenv("TODOIST_API_KEY")
os.Unsetenv("TRELLO_API_KEY")
os.Unsetenv("TRELLO_TOKEN")
}()
@@ -319,7 +299,6 @@ func TestConfig_ClaudomatorURL_EnvOverride(t *testing.T) {
func TestLoad_ValidationError(t *testing.T) {
// Clear required env vars to trigger validation error
- os.Unsetenv("TODOIST_API_KEY")
os.Unsetenv("TRELLO_API_KEY")
os.Unsetenv("TRELLO_TOKEN")