From 913915310fab23dcd683e470ea6116b8d353176d Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 5 Jul 2017 11:57:30 +0100 Subject: [PATCH] Use an int for the config version --- dendrite-config.yaml | 7 +++++-- src/github.com/matrix-org/dendrite/common/config/config.go | 4 ++-- .../matrix-org/dendrite/common/config/config_test.go | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dendrite-config.yaml b/dendrite-config.yaml index 17d89fe19..0fc8e8baa 100644 --- a/dendrite-config.yaml +++ b/dendrite-config.yaml @@ -1,5 +1,8 @@ -# The config file version format -version: v0 +# The config file format version +# This is used by dendrite to tell if it understands the config format. +# This will change if the structure of the config file changes or if the meaning +# of an existing config key changes. +version: 0 # The matrix specific config matrix: diff --git a/src/github.com/matrix-org/dendrite/common/config/config.go b/src/github.com/matrix-org/dendrite/common/config/config.go index a4977731f..473fe9c6c 100644 --- a/src/github.com/matrix-org/dendrite/common/config/config.go +++ b/src/github.com/matrix-org/dendrite/common/config/config.go @@ -30,7 +30,7 @@ import ( // Version is the current version of the config format. // This will change whenever we make breaking changes to the config format. -const Version = "v0" +const Version = 0 // Dendrite contains all the config used by a dendrite process. // Relative paths are resolved relative to the current working directory @@ -41,7 +41,7 @@ type Dendrite struct { // to update their config file to the current version. // The version of the file should only be different if there has // been a breaking change to the config file format. - Version string `yaml:"version"` + Version int `yaml:"version"` // The configuration required for a matrix server. Matrix struct { diff --git a/src/github.com/matrix-org/dendrite/common/config/config_test.go b/src/github.com/matrix-org/dendrite/common/config/config_test.go index f690882ef..7af619688 100644 --- a/src/github.com/matrix-org/dendrite/common/config/config_test.go +++ b/src/github.com/matrix-org/dendrite/common/config/config_test.go @@ -32,7 +32,7 @@ func TestLoadConfigRelative(t *testing.T) { } const testConfig = ` -version: v0 +version: 0 matrix: server_name: localhost private_key: matrix_key.pem