Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off (or alter other options of) TypeCheck in dependencies #61

Closed
Qqwy opened this issue Oct 4, 2021 · 3 comments · Fixed by #122
Closed

Turn off (or alter other options of) TypeCheck in dependencies #61

Qqwy opened this issue Oct 4, 2021 · 3 comments · Fixed by #122
Labels
enhancement New feature or request

Comments

@Qqwy
Copy link
Owner

Qqwy commented Oct 4, 2021

When TypeCheck is in use in a dependency of your application, you might want to alter how it works.
Maybe there are extra overrides you want to provide, or maybe you want to enable debug mode, or maybe turn it off all-together in a particular environment.

One approach to do this might be to have TypeCheck.Options.new look at Application.compile_env(Application.get_application(caller), :type_check).

@Qqwy Qqwy added the enhancement New feature or request label Oct 4, 2021
@baldwindavid
Copy link
Contributor

I was thinking about adding TypeCheck to a library of mine that is a dependency of our application and wondered about this. I was planning to probably set enable_runtime_checks to false in production, but it would be nice if that was configurable at some point given our app may want to reference dependency @type!s. How/where might you see the actual configuration being done?

Would it potentially be something in config.exs like?...

  config :type_check,
  dependencies: %{
    # same options available to `use TypeCheck`
    some_dep_1: [enable_runtime_checks: ...
    some_dep_2: [...
  }

@Qqwy
Copy link
Owner Author

Qqwy commented Oct 4, 2021

I was thinking:

config :your_dependency_name, :type_check,
  # same options available to `use TypeCheck`
  enable_runtime_checks: false,
  # etc.

This approach is used by other libraries as well. Check for instance how Logger manages its (OTP-)application-specific logging settings.

@baldwindavid
Copy link
Contributor

baldwindavid commented Oct 4, 2021

Ah, that looks like a nice way to configure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants