Skip to content

Commit 6938d1b

Browse files
committed
Generate empty config with comments
1 parent 6e61304 commit 6938d1b

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

config.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1+
2+
13
[MySQL]
24
mysql_host = ""
35
mysql_port = 3306
46
mysql_username = ""
57
mysql_password = ""
8+
9+
# hosted_in_aws_rds: Optional.
10+
#
11+
# Uses "CALL mysql.rds_kill()" instead of "kill" command.
12+
# Useful in RDS databases or replica where
13+
# "mysql_username" may not have privilege to use "kill"
614
hosted_in_aws_rds = false
15+
16+
# db: Optional.
17+
#
18+
# If provided, filter out long running
19+
# queries from other databases
720
db = ""
821

922
[ssh_tunnel]
@@ -12,8 +25,18 @@
1225
ssh_port = 22
1326
ssh_username = ""
1427
ssh_password = ""
28+
29+
# ssh_private_key takes priority over ssh_password
30+
# if both are provided
1531
ssh_private_key = ""
32+
33+
# ssh_key_passphrase: Optional.
1634
ssh_key_passphrase = ""
1735

1836
[long_running_query]
37+
# Default is 10 seconds.
38+
# kill-mysql-query will only list running queries
39+
# those are being executed for more than or equal to
40+
# this value.
1941
timeout_second = 10
42+

configuration/io.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ func Generate(file string) error {
126126
}
127127
}
128128

129-
config := setDefault()
130129
f, err := os.Create(filePath)
131130
defer f.Close()
132131
if err != nil {
133132
return err
134133
}
135134

136-
if err := toml.NewEncoder(f).Encode(config); err != nil {
135+
_, err = f.WriteString(baseConfig)
136+
if err != nil {
137137
return err
138138
}
139139

configuration/template.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package configuration
2+
3+
var baseConfig =`
4+
5+
[MySQL]
6+
mysql_host = ""
7+
mysql_port = 3306
8+
mysql_username = ""
9+
mysql_password = ""
10+
11+
# hosted_in_aws_rds: Optional.
12+
#
13+
# Uses "CALL mysql.rds_kill()" instead of "kill" command.
14+
# Useful in RDS databases or replica where
15+
# "mysql_username" may not have privilege to use "kill"
16+
hosted_in_aws_rds = false
17+
18+
# db: Optional.
19+
#
20+
# If provided, filter out long running
21+
# queries from other databases
22+
db = ""
23+
24+
[ssh_tunnel]
25+
use_ssh_tunnel = false
26+
ssh_host = ""
27+
ssh_port = 22
28+
ssh_username = ""
29+
ssh_password = ""
30+
31+
# ssh_private_key takes priority over ssh_password
32+
# if both are provided
33+
ssh_private_key = ""
34+
35+
# ssh_key_passphrase: Optional.
36+
ssh_key_passphrase = ""
37+
38+
[long_running_query]
39+
# Default is 10 seconds.
40+
# kill-mysql-query will only list running queries
41+
# those are being executed for more than or equal to
42+
# this value.
43+
timeout_second = 10
44+
45+
`

0 commit comments

Comments
 (0)