Load values from Rocket.toml into managed state #74

Merged
glyph merged 6 commits from rocket_config into main 2022-01-25 09:35:40 +00:00
Owner

Based on discussion in issue #37, this PR moves the standalone_mode and disable_auth parameters into Rocket.toml.

Then, instead of reading the values from environment variables and using lazy_static to define global variables, we load them from the Rocket figment provider and add them to managed state.

Managed state is rad because it can be accessed in routes and in request guards. We can easily extend the RocketConfig struct in the future to accommodate more config parameters. Since this seems to be "the Rocket way" of managing application state, I'm pretty happy about the change.

I also changed development -> debug and production -> release in Rocket.toml. These profile names must have changed in Rocket somewhere along the way (I had been wondering why disable_auth wasn't taking effect like it should be...now it works as expected).

CC: @notplants

Based on discussion in [issue #37](https://git.coopcloud.tech/PeachCloud/peach-workspace/issues/37), this PR moves the `standalone_mode` and `disable_auth` parameters into `Rocket.toml`. Then, instead of reading the values from environment variables and using `lazy_static` to define global variables, we load them from the Rocket figment provider and add them to managed state. Managed state is rad because it can be accessed in routes and in request guards. We can easily extend the `RocketConfig` struct in the future to accommodate more config parameters. Since this seems to be "the Rocket way" of managing application state, I'm pretty happy about the change. I also changed `development` -> `debug` and `production` -> `release` in `Rocket.toml`. These profile names must have changed in Rocket somewhere along the way (I had been wondering why `disable_auth` wasn't taking effect like it should be...now it works as expected). CC: @notplants
glyph added 6 commits 2022-01-18 15:13:04 +00:00
glyph added the
refactor
peach-web
documentation
labels 2022-01-18 15:13:41 +00:00
glyph merged commit b098f73a5f into main 2022-01-25 09:35:40 +00:00
glyph deleted branch rocket_config 2022-01-25 09:35:41 +00:00
Sign in to join this conversation.
No description provided.