Repository: projectdiscovery/subfinder

Issue:
Feature Request: Environment Variables for Config File Paths
### Please describe your feature request:

Add support for environment variables to specify custom paths for config files:
- `SUBFINDER_CONFIG` - Path to config.yaml file  
- `SUBFINDER_PROVIDER_CONFIG` - Path to provider-config.yaml file

### Describe the use case of this feature:

**Docker environments:** Currently users must mount config files to specific paths. With environment variables:
```bash
docker run -e SUBFINDER_CONFIG=/mounted/config.yaml -v /host/configs:/mounted projectdiscovery/subfinder
```

**CI/CD pipelines:** Config files are often in different locations or generated dynamically:
```bash
export SUBFINDER_CONFIG=/ci/generated/config.yaml
subfinder -d example.com
```

**Multi-environment deployments:** Easy switching between dev/staging/prod configs without changing commands.

This would improve usability in containerized and automated environments while maintaining backward compatibility. Similar functionality could benefit other ProjectDiscovery tools as well.

Hints from issue comments:

Solution patch:
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 7a5080a..e6fabe9 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -35,7 +35,7 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        os: [ubuntu-latest, windows-latest, macOS-13]
+        os: [ubuntu-latest, windows-latest, macOS-latest]
     steps:
       - uses: actions/checkout@v4
       - uses: projectdiscovery/actions/setup/go@v1
diff --git a/README.md b/README.md
index 399998a..dad5450 100644
--- a/README.md
+++ b/README.md
@@ -109,6 +109,13 @@ OPTIMIZATION:
   -max-time int  minutes to wait for enumeration results (default 10)
 ```
 
+## Environment Variables
+
+Subfinder supports environment variables to specify custom paths for configuration files:
+
+- `SUBFINDER_CONFIG` - Path to config.yaml file (overrides default `$CONFIG/subfinder/config.yaml`)
+- `SUBFINDER_PROVIDER_CONFIG` - Path to provider-config.yaml file (overrides default `$CONFIG/subfinder/provider-config.yaml`)
+
 # Installation
 
 `subfinder` requires **go1.24** to install successfully. Run the following command to install the latest version:
diff --git a/pkg/runner/options.go b/pkg/runner/options.go
index 7f39e03..a2fd4d4 100644
--- a/pkg/runner/options.go
+++ b/pkg/runner/options.go
@@ -15,6 +15,7 @@ import (
 	"github.com/projectdiscovery/gologger"
 	"github.com/projectdiscovery/subfinder/v2/pkg/passive"
 	"github.com/projectdiscovery/subfinder/v2/pkg/resolve"
+	envutil "github.com/projectdiscovery/utils/env"
 	fileutil "github.com/projectdiscovery/utils/file"
 	folderutil "github.com/projectdiscovery/utils/folder"
 	logutil "github.com/projectdiscovery/utils/log"
@@ -23,8 +24,8 @@ import (
 
 var (
 	configDir                     = folderutil.AppConfigDirOrDefault(".", "subfinder")
-	defaultConfigLocation         = filepath.Join(configDir, "config.yaml")
-	defaultProviderConfigLocation = filepath.Join(configDir, "provider-config.yaml")
+	defaultConfigLocation         = envutil.GetEnvOrDefault("SUBFINDER_CONFIG", filepath.Join(configDir, "config.yaml"))
+	defaultProviderConfigLocation = envutil.GetEnvOrDefault("SUBFINDER_PROVIDER_CONFIG", filepath.Join(configDir, "provider-config.yaml"))
 )
 
 // Options contains the configuration options for tuning



Test patch:
diff --git a/pkg/passive/sources_wo_auth_test.go b/pkg/passive/sources_wo_auth_test.go
index 036588c..01fc57d 100644
--- a/pkg/passive/sources_wo_auth_test.go
+++ b/pkg/passive/sources_wo_auth_test.go
@@ -33,6 +33,7 @@ func TestSourcesWithoutKeys(t *testing.T) {
 		"digitorus",      // failing with "Failed to retrieve certificate"
 		"dnsdumpster",    // failing with "unexpected status code 403 received"
 		"anubis",         // failing with "too many redirects"
+		"threatcrowd",    // failing with "randomly failing with unmarshal error when hit multiple times"
 	}
 
 	domain := "hackerone.com"