-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add export to sqlite feature #154
Conversation
Codecov Report
@@ Coverage Diff @@
## master #154 +/- ##
==========================================
+ Coverage 93.16% 93.32% +0.16%
==========================================
Files 24 25 +1
Lines 1244 1274 +30
==========================================
+ Hits 1159 1189 +30
+ Misses 58 57 -1
- Partials 27 28 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good code-wise. (Even though a lot changed 👍 )
Just curious, whats the motivation around this?
28c1c77
to
f20b66d
Compare
@@ -9,10 +9,8 @@ var Config = struct { | |||
// Port - Flagr server port | |||
Port int `env:"PORT" envDefault:"18000"` | |||
|
|||
// GracefulCleanupTimeout - the timeout after graceful shutdown. It's useful to mitigate Kubernetes | |||
// rolling update race condition. | |||
GracefulCleanupTimeout time.Duration `env:"FLAGR_GRACEFUL_CLEANUP_TIMEOUT" envDefault:"2s"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed as the latest go-swagger supports graceful shutdown
@@ -28,8 +28,12 @@ func init() { | |||
} | |||
|
|||
func setupLogrus() { | |||
l, err := logrus.ParseLevel(Config.LogrusLevel) | |||
if err != nil { | |||
logrus.WithField("err", err).Fatalf("failed to set logrus level:%s", Config.LogrusLevel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
respect the env setting for log level
"github.com/checkr/flagr/pkg/util" | ||
|
||
"github.com/checkr/flagr/swagger_gen/models" | ||
) | ||
|
||
var getDB = repo.GetDB | ||
var getDB = entity.GetDB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor
swagger/export_sqlite.yaml
Outdated
200: | ||
description: > | ||
Export sqlite3 format of the db dump, which is converted from the | ||
from the main database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate "from the"
docs/api_docs/bundle.yaml
Outdated
'200': | ||
description: > | ||
Export sqlite3 format of the db dump, which is converted from the | ||
from the main database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate "from the"
f20b66d
to
382769a
Compare
Description
repo
tohandler
packageexport/sqlite
endpoint for exporting the whole databaseMotivation and Context
I want to setup Flagr for environment other than production. For example, the integration testing env, staging env, or just local unit test env. There's no easy way to copy flags from one flagr deploy to another, and we probably don't want to share the Flagr instances, their databases, or reuse the same Flagr polluting data recording.
This PR builds an interface for exporting data to a simple sqlite file, which can be used for other Flagr instances.
I'm also thinking of serialization into some configuration files, like YAML or TOML. For example,
export/yaml
, and the files can be checked into code for testing or other environment. It may require some work for (de)serialization.How Has This Been Tested?
Locally. Unit tests coming soon.
Types of changes
Checklist: