Commit e285828
committed
feat: support runtime configuration via supervisor start options
Add support for passing configuration options when starting the
Phoenix.SessionProcess supervisor, allowing runtime config to override
application environment settings.
Features:
- Pass config options when starting supervisor
- Runtime config stored in ETS for fast, concurrent access
- Config module checks ETS first, then app env, then defaults
- Supports all config keys: session_process, max_sessions, session_ttl, rate_limit
- Runtime config takes precedence over application environment
Implementation:
- Modified Supervisor.init/1 to create ETS table with runtime config
- Updated Config module to check ETS before falling back to app env
- Added private helpers get_config/2 and lookup_runtime_config/1
- Updated documentation with examples
Example usage:
# Application supervision tree
{Phoenix.SessionProcess, [
session_process: MyApp.SessionProcess,
max_sessions: 20_000,
session_ttl: :timer.hours(2),
rate_limit: 150
]}
All tests pass (148/148), credo passes.1 parent 435bb61 commit e285828
2 files changed
+108
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
48 | 71 | | |
49 | 72 | | |
50 | 73 | | |
| |||
89 | 112 | | |
90 | 113 | | |
91 | 114 | | |
92 | | - | |
| 115 | + | |
93 | 116 | | |
94 | 117 | | |
95 | 118 | | |
| |||
116 | 139 | | |
117 | 140 | | |
118 | 141 | | |
119 | | - | |
| 142 | + | |
120 | 143 | | |
121 | 144 | | |
122 | 145 | | |
| |||
147 | 170 | | |
148 | 171 | | |
149 | 172 | | |
150 | | - | |
| 173 | + | |
151 | 174 | | |
152 | 175 | | |
153 | 176 | | |
| |||
178 | 201 | | |
179 | 202 | | |
180 | 203 | | |
181 | | - | |
| 204 | + | |
182 | 205 | | |
183 | 206 | | |
184 | 207 | | |
| |||
220 | 243 | | |
221 | 244 | | |
222 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
223 | 274 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
41 | 59 | | |
42 | 60 | | |
43 | 61 | | |
| |||
74 | 92 | | |
75 | 93 | | |
76 | 94 | | |
77 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
78 | 115 | | |
79 | 116 | | |
80 | 117 | | |
| |||
84 | 121 | | |
85 | 122 | | |
86 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
87 | 136 | | |
0 commit comments