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

WIP: Global config #23

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

ftes
Copy link
Contributor

@ftes ftes commented Apr 20, 2023

Summary:

  • Add Dx.Repo, similar to Ecto.Repo
  • that acts as a decorator for all Dx functions
  • and applies default options in this precedence: Dx.fn(..., opts) > default_options() > Mix.Config > use.

@ftes ftes marked this pull request as draft April 20, 2023 05:35
@ftes
Copy link
Contributor Author

ftes commented Apr 20, 2023

@arnodirlam Lets discuss before adding tests.

@ftes ftes force-pushed the feature/global-config branch from ce93eee to 065bf91 Compare April 20, 2023 05:39
@arnodirlam
Copy link
Contributor

Thanks a lot for the PR and the work you put in here. I'll have to think about this for a bit and also do some research on other approaches, and will get back to you here 🙏

To get started, why did you choose this approach, and did you consider any other approaches? @ftes

@ftes
Copy link
Contributor Author

ftes commented Apr 20, 2023

Sure, this one's not urgent so definitely worth it to take your time.

Tbh I jumped onto the Ecto.Repo approach after only short consideration, because I know it, I find it useful and somewhat similar to this case.

What I considered:

  • Support Mix.Config for environment-dependent default options (e.g. timeout)
  • Support Ecto.Repo style decorator module
    • allows defining multiple "repos" to support use-case specific default options
    • support both static (use opts) and dynamic default_opts/1 default opts
    • ease of adoption: copy well-known ecto approach

Things it might be worth to consider:

  • unnecessary complexity: is this overkill?
  • naming: is Dx.Repo a good name?

@ftes ftes force-pushed the feature/global-config branch from 065bf91 to f218395 Compare April 24, 2023 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants