@@ -12,14 +12,15 @@ import (
1212)
1313
1414var (
15- apertureDataDir = btcutil .AppDataDir ("aperture" , false )
16- defaultConfigFilename = "aperture.yaml"
17- defaultTLSKeyFilename = "tls.key"
18- defaultTLSCertFilename = "tls.cert"
19- defaultLogLevel = "info"
20- defaultLogFilename = "aperture.log"
21- defaultMaxLogFiles = 3
22- defaultMaxLogFileSize = 10
15+ apertureDataDir = btcutil .AppDataDir ("aperture" , false )
16+ defaultConfigFilename = "aperture.yaml"
17+ defaultTLSKeyFilename = "tls.key"
18+ defaultTLSCertFilename = "tls.cert"
19+ defaultLogLevel = "info"
20+ defaultLogFilename = "aperture.log"
21+ defaultMaxLogFiles = 3
22+ defaultMaxLogFileSize = 10
23+ defaultInvoiceBatchSize = 100000
2324
2425 defaultSqliteDatabaseFileName = "aperture.db"
2526
@@ -219,6 +220,10 @@ type Config struct {
219220 // WriteTimeout is the maximum amount of time to wait for a response to
220221 // be fully written.
221222 WriteTimeout time.Duration `long:"writetimeout" description:"The maximum amount of time to wait for a response to be fully written."`
223+
224+ // InvoiceBatchSize is the number of invoices to fetch in a single
225+ // request.
226+ InvoiceBatchSize int `long:"invoicebatchsize" description:"The number of invoices to fetch in a single request."`
222227}
223228
224229func (c * Config ) validate () error {
@@ -232,6 +237,10 @@ func (c *Config) validate() error {
232237 return fmt .Errorf ("missing listen address for server" )
233238 }
234239
240+ if c .InvoiceBatchSize <= 0 {
241+ return fmt .Errorf ("invoice batch size must be greater than 0" )
242+ }
243+
235244 return nil
236245}
237246
@@ -246,16 +255,17 @@ func DefaultSqliteConfig() *aperturedb.SqliteConfig {
246255// NewConfig initializes a new Config variable.
247256func NewConfig () * Config {
248257 return & Config {
249- DatabaseBackend : "etcd" ,
250- Etcd : & EtcdConfig {},
251- Sqlite : DefaultSqliteConfig (),
252- Postgres : & aperturedb.PostgresConfig {},
253- Authenticator : & AuthConfig {},
254- Tor : & TorConfig {},
255- HashMail : & HashMailConfig {},
256- Prometheus : & PrometheusConfig {},
257- IdleTimeout : defaultIdleTimeout ,
258- ReadTimeout : defaultReadTimeout ,
259- WriteTimeout : defaultWriteTimeout ,
258+ DatabaseBackend : "etcd" ,
259+ Etcd : & EtcdConfig {},
260+ Sqlite : DefaultSqliteConfig (),
261+ Postgres : & aperturedb.PostgresConfig {},
262+ Authenticator : & AuthConfig {},
263+ Tor : & TorConfig {},
264+ HashMail : & HashMailConfig {},
265+ Prometheus : & PrometheusConfig {},
266+ IdleTimeout : defaultIdleTimeout ,
267+ ReadTimeout : defaultReadTimeout ,
268+ WriteTimeout : defaultWriteTimeout ,
269+ InvoiceBatchSize : defaultInvoiceBatchSize ,
260270 }
261271}
0 commit comments