feat: make YouTube API key optional in setup

- Change API key setup question to optional
- Add test for optional API key behavior
- Ensure plugin configuration without API key
- chore: incoming 1827 changelog entry
This commit is contained in:
Kayvan Sylvan
2025-11-13 23:34:28 -08:00
parent c498085feb
commit d02a55ee01
3 changed files with 26 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
### PR [#1827](https://github.com/danielmiessler/Fabric/pull/1827) by [ksylvan](https://github.com/ksylvan): Make YouTube API key optional in setup
- Make YouTube API key optional in setup process
- Change API key setup question to optional configuration
- Add test for optional API key behavior
- Ensure plugin configuration works without API key

View File

@@ -69,7 +69,7 @@ func NewYouTube() (ret *YouTube) {
EnvNamePrefix: plugins.BuildEnvVariablePrefix(label),
}
ret.ApiKey = ret.AddSetupQuestion("API key", true)
ret.ApiKey = ret.AddSetupQuestion("API key", false)
return
}

View File

@@ -0,0 +1,19 @@
package youtube
import "testing"
func TestNewYouTubeApiKeyOptional(t *testing.T) {
yt := NewYouTube()
if yt.ApiKey == nil {
t.Fatal("expected API key setup question to be initialized")
}
if yt.ApiKey.Required {
t.Fatalf("expected YouTube API key to be optional, but it is marked as required")
}
if !yt.IsConfigured() {
t.Fatalf("expected YouTube plugin to be considered configured without an API key")
}
}