@@ -115,6 +115,7 @@ func InteractiveSetup(conf *util.ConfigType) {
115
115
1 - MySQL
116
116
2 - BoltDB
117
117
3 - PostgreSQL
118
+ 4 - SQLite
118
119
`
119
120
120
121
var db int
@@ -130,6 +131,9 @@ func InteractiveSetup(conf *util.ConfigType) {
130
131
case 3 :
131
132
conf .Dialect = util .DbDriverPostgres
132
133
scanPostgres (conf )
134
+ case 4 :
135
+ conf .Dialect = util .DbDriverSQLite
136
+ scanSQLite (conf )
133
137
}
134
138
135
139
defaultPlaybookPath := filepath .Join (os .TempDir (), "semaphore" )
@@ -183,13 +187,11 @@ func InteractiveSetup(conf *util.ConfigType) {
183
187
}
184
188
185
189
func scanBoltDb (conf * util.ConfigType ) {
186
- workingDirectory , err := os .Getwd ()
187
- if err != nil {
188
- workingDirectory = os .TempDir ()
189
- }
190
- defaultBoltDBPath := filepath .Join (workingDirectory , "database.boltdb" )
191
- conf .BoltDb = & util.DbConfig {}
192
- askValue ("db filename" , defaultBoltDBPath , & conf .BoltDb .Hostname )
190
+ conf .BoltDb = scanFileDB ("database.boltdb" )
191
+ }
192
+
193
+ func scanSQLite (conf * util.ConfigType ) {
194
+ conf .SQLite = scanFileDB ("database.sqlite" )
193
195
}
194
196
195
197
func scanMySQL (conf * util.ConfigType ) {
@@ -214,6 +216,17 @@ func scanPostgres(conf *util.ConfigType) {
214
216
}
215
217
}
216
218
219
+ func scanFileDB (defaultDbFile string ) * util.DbConfig {
220
+ workingDirectory , err := os .Getwd ()
221
+ if err != nil {
222
+ workingDirectory = os .TempDir ()
223
+ }
224
+ defaultDBPath := filepath .Join (workingDirectory , defaultDbFile )
225
+ conf := & util.DbConfig {}
226
+ askValue ("db Hostname" , defaultDBPath , & conf .Hostname )
227
+ return conf
228
+ }
229
+
217
230
func scanErrorChecker (n int , err error ) {
218
231
if err != nil && err .Error () != "unexpected newline" {
219
232
log .Warn ("An input error occurred: " + err .Error ())
0 commit comments