Skip to content

Commit 42740b8

Browse files
authored
Empty datafile passed before fetching datafile (#25)
1 parent 79a4a1b commit 42740b8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/kotlin/com/featurevisor/sdk/Instance.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ typealias ConfigureBucketValue = (Feature, Context, BucketValue) -> BucketValue
1515
typealias InterceptContext = (Context) -> Context
1616
typealias DatafileFetchHandler = (datafileUrl: String) -> Result<DatafileContent>
1717

18+
var emptyDatafile = DatafileContent(
19+
schemaVersion = "1",
20+
revision = "unknown",
21+
attributes = emptyList(),
22+
segments = emptyList(),
23+
features = emptyList(),
24+
)
25+
1826
class FeaturevisorInstance private constructor(options: InstanceOptions) {
1927

2028
companion object {
@@ -91,6 +99,7 @@ class FeaturevisorInstance private constructor(options: InstanceOptions) {
9199
}
92100

93101
datafileUrl != null -> {
102+
datafileReader = DatafileReader(options.datafile?: emptyDatafile)
94103
fetchDatafileContent(datafileUrl) { result ->
95104
if (result.isSuccess) {
96105
datafileReader = DatafileReader(result.getOrThrow())

0 commit comments

Comments
 (0)