25 lines
604 B
Go
25 lines
604 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/caarlos0/env"
|
|
)
|
|
|
|
type Config struct {
|
|
E621APIKey string `env:"E621_API_KEY,required"`
|
|
E621Username string `env:"E621_USERNAME,required"`
|
|
Neo4jURL string `env:"NEO4J_URL,required"`
|
|
Neo4jUsername string `env:"NEO4J_USERNAME,required"`
|
|
Neo4jPassword string `env:"NEO4J_PASSWORD,required"`
|
|
}
|
|
|
|
// LoadConfig loads the configuration from environment variables
|
|
func LoadConfig() (*Config, error) {
|
|
config := &Config{}
|
|
if err := env.Parse(config); err != nil {
|
|
return nil, fmt.Errorf("error parsing configuration: %w", err)
|
|
}
|
|
|
|
return config, nil
|
|
}
|