check.go 488 B

1234567891011121314151617181920212223
  1. package service
  2. import (
  3. "errors"
  4. "github.com/langgenius/dify-sandbox/internal/core/runner/types"
  5. "github.com/langgenius/dify-sandbox/internal/static"
  6. )
  7. var (
  8. ErrNetworkDisabled = errors.New("network is disabled, please enable it in the configuration")
  9. )
  10. func checkOptions(options *types.RunnerOptions) error {
  11. configuration := static.GetDifySandboxGlobalConfigurations()
  12. if options.EnableNetwork && !configuration.EnableNetwork {
  13. return ErrNetworkDisabled
  14. }
  15. return nil
  16. }