@@ -22,30 +22,30 @@ public enum Runtime {
2222 @TaskLocal
2323 static var _currentConfiguration : Configuration ?
2424
25- static var _bootstrapConfiguration = BootstrappableConfiguration ( )
26-
27- /// Bootstrap the workflow runtime with the given configuration.
28- /// This can only be called once per process and must be called from the main thread.
25+ /// Update the base configuration used by the workflow runtime when creating
26+ /// new `WorkflowHost` instances. Note, is unaffected by any customizations that may
27+ /// have occurred in earlier calls to this method.
28+ /// - Note: Updating this does not affect the existing configuration values used by
29+ /// extant `WorkflowHost` instances.
2930 ///
3031 /// - Parameter configuration: The runtime configuration to use.
3132 @MainActor
32- public static func bootstrap (
33+ public static func updateDefaultConfiguration (
3334 _ configureBlock: ( inout Configuration ) -> Void
3435 ) {
3536 MainActor . preconditionIsolated (
36- " The Workflow runtime must be bootstrapped from the main actor."
37+ " Must be called from the main actor."
3738 )
38- guard !_isBootstrapped else {
39- fatalError ( " The Workflow runtime can only be bootstrapped once. " )
40- }
4139
42- var config = _bootstrapConfiguration . currentConfiguration
40+ var config = Configuration ( )
4341 configureBlock ( & config)
44- _bootstrapConfiguration . _bootstrapConfig = config
42+ _defaultConfiguration = config
4543 }
4644
45+ private static var _defaultConfiguration = Configuration ( )
46+
4747 static var configuration : Configuration {
48- _currentConfiguration ?? _bootstrapConfiguration . currentConfiguration
48+ _currentConfiguration ?? _defaultConfiguration
4949 }
5050
5151 /// Allows temporary customization of the runtime configuration during the execution of the `operation`.
@@ -67,17 +67,6 @@ public enum Runtime {
6767 operation: operation
6868 )
6969 }
70-
71- // MARK: -
72-
73- private static var _isBootstrapped : Bool {
74- _bootstrapConfiguration. _bootstrapConfig != nil
75- }
76-
77- /// The current runtime configuration that may have been set via `bootstrap()`.
78- private static var _currentBootstrapConfiguration : Configuration {
79- _bootstrapConfiguration. currentConfiguration
80- }
8170}
8271
8372extension Runtime {
@@ -93,14 +82,4 @@ extension Runtime {
9382 /// This is expected to eventually be removed and become the default behavior.
9483 public var useSinkEventHandler : Bool = false
9584 }
96-
97- struct BootstrappableConfiguration {
98- var _bootstrapConfig : Configuration ?
99- let _defaultConfig : Configuration = . default
100-
101- /// The current runtime configuration that may have been set via `Runtime.bootstrap()`.
102- var currentConfiguration : Configuration {
103- _bootstrapConfig ?? _defaultConfig
104- }
105- }
10685}
0 commit comments