aplbrain / bossphorus

A BossDB-like volumetric datastore in Rust
Apache License 2.0
1 stars 1 forks source link

Allow user to configure the DataManager stack they want to run #11

Open j6k4m8 opened 4 years ago

j6k4m8 commented 4 years ago

I'm thinking we should make the binary configurable in a file, but with sane defaults. Something like:

config.yml

port: 8090
cache: "LRU"

usage_manager: "console"

data_managers:

    - ChunkedFileDataManager:
        upload_path: "uploads/"

    - BossDBRelayDataManager:
        host:        "bossdb.io"
        protocol:    "https"
        token:       "public"

And callable with bossphorus --config config.yml

In particular, I think being able to specify which data managers are used and in which order is something users may want to be able to do at runtime, which is perhaps a bit more complicated than the current env-variable technique allows.

@movestill thoughts?

j6k4m8 commented 4 years ago

to be clear, I am VERY happy with this not being yaml.

movestill commented 4 years ago

Agree that what you have in mind for data managers is too complex for the current config scheme. If we go to a straight config file, then I think we should still include one env variable that if set, will provide full path to a config file. Then we still have the option of changing the config if the app is containerized w/o having to rebuild the image.

I think I'm ok with YAML since at least it allows comments! This hierarchical structure isn't supported will with the INI format, right?

j6k4m8 commented 4 years ago

Agreed re: the env variable! I'd prefer to do everything with env variables but I think it's a bit unfeasible for this complexity of config.

We could also do json-with-comments, though probably it's easier to get started with yml. We can always replace it if it gets annoying :)