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: Rewrite config with annotations and macros #917

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

viktorerlingsson
Copy link
Member

Work in progress / suggestion

WHAT is this pull request doing?

Rewrites config.cr with the use of annotations and macros to specify how each property can be set. Each property can have multiple annotations to be available to configure in multiple ways.

    @[CliOpt("-D DIRECTORY", "--data-dir=DIRECTORY", "Data directory")]
    @[IniOpt(section: "main")]
    @[EnvOpt("LAVINMQ_DATADIR")]
    property data_dir : String = "/var/lib/lavinmq"

@[CliOpt("-D DIRECTORY", "--data-dir=DIRECTORY", "Data directory")]
for options to be configured by command line

@[IniOpt(section: "main")]
for options to be configured by config file

@[EnvOpt("LAVINMQ_DATADIR")]
for options to be configured by env variables

HOW can this pull request be tested?

No specs yet, however, it should be possible to cover this pretty well with specs.

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.

1 participant