Skip to content

Commit e689108

Browse files
committed
Configurable initialization #23
1 parent e1b689b commit e689108

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/CosmoStore.CosmosDb/CosmosDb.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ type Configuration = {
1717
CollectionName : string
1818
ServiceEndpoint : Uri
1919
AuthKey : string
20-
Throughput: int
20+
Throughput : int
21+
InitializeCollection : bool
2122
}
2223
with
2324
static member CreateDefault serviceEndpoint authKey = {
@@ -26,4 +27,5 @@ with
2627
ServiceEndpoint = serviceEndpoint
2728
AuthKey = authKey
2829
Throughput = Throughput.min
30+
InitializeCollection = true
2931
}

src/CosmoStore.CosmosDb/EventStore.fs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,12 @@ let getEventStore (configuration:Configuration) =
158158
let appendEventProcUri = UriFactory.CreateStoredProcedureUri(configuration.DatabaseName, configuration.CollectionName, appendEventProcName)
159159
let eventAppended = Event<EventRead>()
160160

161-
task {
162-
do! createDatabase configuration.DatabaseName client
163-
do! createCollection dbUri configuration client
164-
do! createStoreProcedures eventsCollectionUri appendEventProcUri configuration.CollectionName client
165-
} |> Async.AwaitTask |> Async.RunSynchronously
161+
if configuration.InitializeCollection then
162+
task {
163+
do! createDatabase configuration.DatabaseName client
164+
do! createCollection dbUri configuration client
165+
do! createStoreProcedures eventsCollectionUri appendEventProcUri configuration.CollectionName client
166+
} |> Async.AwaitTask |> Async.RunSynchronously
166167

167168
{
168169
AppendEvent = fun stream pos event -> task {

src/CosmoStore.CosmosDb/RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 2.1.0 - May 17 2019
2+
* Configurable collection name #25
3+
* Configurable initialization #23
4+
15
### 2.0.1 - February 12 2019
26
* Fixing typo StarsWith vs StartsWith
37

src/CosmoStore/RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 2.1.0 - May 14 2019
2+
* Added helper functions for validation and conversion
3+
14
### 2.0.1 - February 12 2019
25
* Fixing typo StarsWith vs StartsWith
36

0 commit comments

Comments
 (0)