1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-07-03 00:46:58 +02:00

Feature: Allow version checking to be disabled (#524)

This commit is contained in:
Ben Edmunds
2025-06-19 11:29:20 +01:00
committed by GitHub
parent 3aae06ff6b
commit 95e3ef6fca
4 changed files with 44 additions and 32 deletions

View File

@ -93,6 +93,7 @@ func init() {
rootCmd.Flags().StringVarP(&config.Database, "database", "d", config.Database, "Database to store persistent data") rootCmd.Flags().StringVarP(&config.Database, "database", "d", config.Database, "Database to store persistent data")
rootCmd.Flags().BoolVar(&config.DisableWAL, "disable-wal", config.DisableWAL, "Disable WAL for local database (allows NFS mounted DBs)") rootCmd.Flags().BoolVar(&config.DisableWAL, "disable-wal", config.DisableWAL, "Disable WAL for local database (allows NFS mounted DBs)")
rootCmd.Flags().BoolVar(&config.DisableVersionCheck, "disable-version-check", config.DisableVersionCheck, "Disable version update checking")
rootCmd.Flags().IntVar(&config.Compression, "compression", config.Compression, "Compression level to store raw messages (0-3)") rootCmd.Flags().IntVar(&config.Compression, "compression", config.Compression, "Compression level to store raw messages (0-3)")
rootCmd.Flags().StringVar(&config.Label, "label", config.Label, "Optional label identify this Mailpit instance") rootCmd.Flags().StringVar(&config.Label, "label", config.Label, "Optional label identify this Mailpit instance")
rootCmd.Flags().StringVar(&config.TenantID, "tenant-id", config.TenantID, "Database tenant ID to isolate data") rootCmd.Flags().StringVar(&config.TenantID, "tenant-id", config.TenantID, "Database tenant ID to isolate data")
@ -204,6 +205,8 @@ func initConfigFromEnv() {
config.DisableWAL = getEnabledFromEnv("MP_DISABLE_WAL") config.DisableWAL = getEnabledFromEnv("MP_DISABLE_WAL")
config.DisableVersionCheck = getEnabledFromEnv("MP_DISABLE_VERSION_CHECK")
if len(os.Getenv("MP_COMPRESSION")) > 0 { if len(os.Getenv("MP_COMPRESSION")) > 0 {
config.Compression, _ = strconv.Atoi(os.Getenv("MP_COMPRESSION")) config.Compression, _ = strconv.Atoi(os.Getenv("MP_COMPRESSION"))
} }

View File

@ -213,6 +213,9 @@ var (
// DisableHTMLCheck DEPRECATED 2024/04/13 - kept here to display console warning only // DisableHTMLCheck DEPRECATED 2024/04/13 - kept here to display console warning only
DisableHTMLCheck = false DisableHTMLCheck = false
// DisableVersionCheck disables version checking
DisableVersionCheck bool
// DemoMode disables SMTP relay, link checking & HTTP send functionality // DemoMode disables SMTP relay, link checking & HTTP send functionality
DemoMode = false DemoMode = false
) )

View File

@ -97,6 +97,9 @@ func Load() AppInformation {
info.RuntimeStats.SMTPRejected = smtpRejected info.RuntimeStats.SMTPRejected = smtpRejected
info.RuntimeStats.SMTPIgnored = smtpIgnored info.RuntimeStats.SMTPIgnored = smtpIgnored
if config.DisableVersionCheck {
info.LatestVersion = "disabled"
} else {
mu.RLock() mu.RLock()
cacheValid := time.Now().Before(vCache.expiry) cacheValid := time.Now().Before(vCache.expiry)
cacheValue := vCache.value cacheValue := vCache.value
@ -124,6 +127,7 @@ func Load() AppInformation {
} }
mu.Unlock() mu.Unlock()
} }
}
info.Database = config.Database info.Database = config.Database
info.DatabaseSize = storage.DbSize() info.DatabaseSize = storage.DbSize()

View File

@ -91,6 +91,7 @@ export default {
<div class="modal-body"> <div class="modal-body">
<div class="row g-3"> <div class="row g-3">
<div class="col-xl-6"> <div class="col-xl-6">
<div v-if="mailbox.appInfo.LatestVersion != 'disabled'">
<div class="row g-3" v-if="mailbox.appInfo.LatestVersion == ''"> <div class="row g-3" v-if="mailbox.appInfo.LatestVersion == ''">
<div class="col"> <div class="col">
<div class="alert alert-warning mb-3"> <div class="alert alert-warning mb-3">
@ -107,6 +108,7 @@ export default {
</a> </a>
</div> </div>
</div> </div>
</div>
<div class="row g-3"> <div class="row g-3">
<div class="col-12"> <div class="col-12">
<RouterLink to="/api/v1/" class="btn btn-primary w-100" target="_blank"> <RouterLink to="/api/v1/" class="btn btn-primary w-100" target="_blank">