2021-06-01 13:18:49 +00:00
package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"gopkg.in/ini.v1"
)
2024-08-01 19:17:05 +00:00
// NOTE: This is the one file where log messages are not part of logmessages/logmessages.go
2021-06-01 13:18:49 +00:00
func runMigrations ( app * appContext ) {
migrateProfiles ( app )
migrateBootstrap ( app )
2024-08-12 17:53:46 +00:00
migrateExternalURL ( app )
2021-06-01 13:18:49 +00:00
migrateEmailStorage ( app )
2021-11-17 16:16:19 +00:00
migrateNotificationMethods ( app )
2022-01-25 18:02:04 +00:00
linkExistingOmbiDiscordTelegram ( app )
2021-06-01 13:18:49 +00:00
// migrateHyphens(app)
2023-06-24 18:13:05 +00:00
migrateToBadger ( app )
2024-07-28 15:02:47 +00:00
intialiseCustomContent ( app )
2021-06-01 13:18:49 +00:00
}
// Migrate pre-0.2.0 user templates to profiles
func migrateProfiles ( app * appContext ) {
2023-06-25 17:52:27 +00:00
if app . storage . deprecatedPolicy . BlockedTags == nil && app . storage . deprecatedConfiguration . GroupedFolders == nil && len ( app . storage . deprecatedDisplayprefs ) == 0 {
2023-06-24 18:13:05 +00:00
return
}
app . info . Println ( "Migrating user template files to new profile format" )
app . storage . migrateToProfile ( )
for _ , path := range [ 3 ] string { app . storage . policy_path , app . storage . configuration_path , app . storage . displayprefs_path } {
if _ , err := os . Stat ( path ) ; ! os . IsNotExist ( err ) {
dir , fname := filepath . Split ( path )
newFname := strings . Replace ( fname , ".json" , ".old.json" , 1 )
err := os . Rename ( path , filepath . Join ( dir , newFname ) )
if err != nil {
app . err . Fatalf ( "Failed to rename %s: %s" , fname , err )
2021-06-01 13:18:49 +00:00
}
}
}
2023-06-24 18:13:05 +00:00
app . info . Println ( "In case of a problem, your original files have been renamed to <file>.old.json" )
app . storage . storeProfiles ( )
2021-06-01 13:18:49 +00:00
}
// Migrate pre-0.2.5 bootstrap theme choice to a17t version.
func migrateBootstrap ( app * appContext ) {
themes := map [ string ] string {
2021-12-31 17:28:08 +00:00
"Jellyfin (Dark)" : "dark" ,
"Default (Light)" : "light" ,
2021-06-01 13:18:49 +00:00
}
if app . config . Section ( "ui" ) . Key ( "theme" ) . String ( ) == "Bootstrap (Light)" {
app . config . Section ( "ui" ) . Key ( "theme" ) . SetValue ( "Default (Light)" )
}
if val , ok := themes [ app . config . Section ( "ui" ) . Key ( "theme" ) . String ( ) ] ; ok {
app . cssClass = val
}
}
func migrateEmailConfig ( app * appContext ) {
2024-08-20 19:19:32 +00:00
tempConfig , _ := ini . ShadowLoad ( app . configPath )
2021-06-01 13:18:49 +00:00
fmt . Println ( warning ( "Part of your email configuration will be migrated to the new \"messages\" section.\nA backup will be made." ) )
err := tempConfig . SaveTo ( app . configPath + "_" + commit + ".bak" )
if err != nil {
app . err . Fatalf ( "Failed to backup config: %v" , err )
return
}
for _ , setting := range [ ] string { "use_24h" , "date_format" , "message" } {
if val := app . config . Section ( "email" ) . Key ( setting ) . Value ( ) ; val != "" {
tempConfig . Section ( "email" ) . Key ( setting ) . SetValue ( "" )
tempConfig . Section ( "messages" ) . Key ( setting ) . SetValue ( val )
}
}
if app . config . Section ( "messages" ) . Key ( "enabled" ) . MustBool ( false ) || app . config . Section ( "telegram" ) . Key ( "enabled" ) . MustBool ( false ) {
tempConfig . Section ( "messages" ) . Key ( "enabled" ) . SetValue ( "true" )
}
err = tempConfig . SaveTo ( app . configPath )
if err != nil {
app . err . Fatalf ( "Failed to save config: %v" , err )
return
}
app . loadConfig ( )
}
// Migrate pre-0.3.6 email settings to the new messages section.
// Called just after loading email storage in main.go.
func migrateEmailStorage ( app * appContext ) error {
// use_24h was moved to messages, so this checks if migration has already occurred or not.
if app . config . Section ( "email" ) . Key ( "use_24h" ) . Value ( ) == "" {
return nil
}
var emails map [ string ] interface { }
err := loadJSON ( app . storage . emails_path , & emails )
if err != nil {
return err
}
newEmails := map [ string ] EmailAddress { }
for jfID , addr := range emails {
2021-08-25 17:10:06 +00:00
switch addr . ( type ) {
case string :
newEmails [ jfID ] = EmailAddress {
Addr : addr . ( string ) ,
Contact : true ,
}
// In case email settings still persist after migration has already happened
case map [ string ] interface { } :
return nil
default :
2021-08-26 17:39:50 +00:00
return fmt . Errorf ( "email address was type %T, not string: \"%+v\"\n" , addr , addr )
2021-06-01 13:18:49 +00:00
}
}
2024-08-20 19:19:32 +00:00
config , err := ini . ShadowLoad ( app . configPath )
2021-08-25 17:10:06 +00:00
if err != nil {
return err
}
config . Section ( "email" ) . Key ( "use_24h" ) . SetValue ( "" )
if err := config . SaveTo ( app . configPath ) ; err != nil {
return err
}
2021-06-01 13:18:49 +00:00
err = storeJSON ( app . storage . emails_path + ".bak" , emails )
if err != nil {
return err
}
err = storeJSON ( app . storage . emails_path , newEmails )
if err != nil {
return err
}
app . info . Println ( "Migrated to new email format. A backup has also been made." )
return nil
}
2022-01-30 14:27:00 +00:00
// Pre-0.4.0, Admin notifications for invites were indexed by and only sent to email addresses. Now, when Jellyfin Login is enabled, They are indexed by the admin's Jellyfin ID, and send by any method enabled for them. This migrates storage to that format.
2021-11-17 16:16:19 +00:00
func migrateNotificationMethods ( app * appContext ) error {
if ! app . config . Section ( "ui" ) . Key ( "jellyfin_login" ) . MustBool ( false ) {
return nil
}
changes := false
2023-06-24 18:13:05 +00:00
for code , invite := range app . storage . deprecatedInvites {
2021-11-17 16:16:19 +00:00
if invite . Notify == nil {
continue
}
for address , notifyPrefs := range invite . Notify {
if ! strings . Contains ( address , "@" ) {
continue
}
2023-06-24 16:01:52 +00:00
for _ , email := range app . storage . GetEmails ( ) {
2021-11-17 16:16:19 +00:00
if email . Addr == address {
2023-06-24 16:01:52 +00:00
invite . Notify [ email . JellyfinID ] = notifyPrefs
2021-11-17 16:16:19 +00:00
delete ( invite . Notify , address )
changes = true
break
}
}
}
if changes {
2023-06-24 18:13:05 +00:00
app . storage . deprecatedInvites [ code ] = invite
2021-11-17 16:16:19 +00:00
}
}
if changes {
app . info . Printf ( "Migrated to modified invite storage format." )
return app . storage . storeInvites ( )
}
return nil
}
2022-01-30 14:27:00 +00:00
// Pre-0.4.0, Ombi users were created without linking their Discord & Telegram accounts. This will add them.
2022-01-25 18:02:04 +00:00
func linkExistingOmbiDiscordTelegram ( app * appContext ) error {
if ! discordEnabled && ! telegramEnabled {
return nil
}
if ! app . config . Section ( "ombi" ) . Key ( "enabled" ) . MustBool ( false ) {
return nil
}
idList := map [ string ] [ 2 ] string { }
2023-06-24 16:01:52 +00:00
for _ , user := range app . storage . GetDiscord ( ) {
idList [ user . JellyfinID ] = [ 2 ] string { user . ID , "" }
2022-01-25 18:02:04 +00:00
}
2023-06-24 16:01:52 +00:00
for _ , user := range app . storage . GetTelegram ( ) {
vals , ok := idList [ user . JellyfinID ]
2022-01-25 18:02:04 +00:00
if ! ok {
vals = [ 2 ] string { "" , "" }
}
vals [ 1 ] = user . Username
2023-06-24 16:01:52 +00:00
idList [ user . JellyfinID ] = vals
2022-01-25 18:02:04 +00:00
}
for jfID , ids := range idList {
2024-08-06 13:48:31 +00:00
ombiUser , err := app . getOmbiUser ( jfID )
if err != nil {
app . debug . Printf ( "Failed to get Ombi user with Discord/Telegram \"%s\"/\"%s\": %v" , ids [ 0 ] , ids [ 1 ] , err )
2022-01-25 18:02:04 +00:00
continue
}
2024-08-06 13:48:31 +00:00
_ , err = app . ombi . SetNotificationPrefs ( ombiUser , ids [ 0 ] , ids [ 1 ] )
if err != nil {
app . debug . Printf ( "Failed to set prefs for Ombi user \"%s\": %v" , ombiUser [ "userName" ] . ( string ) , err )
2022-01-25 18:02:04 +00:00
continue
}
}
return nil
}
2023-06-25 18:59:11 +00:00
// MigrationStatus is just used to store whether data from JSON files has been migrated to the DB.
type MigrationStatus struct {
Done bool
}
2023-06-25 19:15:15 +00:00
func loadLegacyData ( app * appContext ) {
app . storage . invite_path = app . config . Section ( "files" ) . Key ( "invites" ) . String ( )
if err := app . storage . loadInvites ( ) ; err != nil {
app . err . Printf ( "LegacyData: Failed to load Invites: %v" , err )
}
app . storage . emails_path = app . config . Section ( "files" ) . Key ( "emails" ) . String ( )
if err := app . storage . loadEmails ( ) ; err != nil {
app . err . Printf ( "LegacyData: Failed to load Emails: %v" , err )
err := migrateEmailStorage ( app )
if err != nil {
app . err . Printf ( "LegacyData: Failed to migrate Email storage: %v" , err )
}
}
app . storage . users_path = app . config . Section ( "files" ) . Key ( "users" ) . String ( )
if err := app . storage . loadUserExpiries ( ) ; err != nil {
app . err . Printf ( "LegacyData: Failed to load Users: %v" , err )
}
app . storage . telegram_path = app . config . Section ( "files" ) . Key ( "telegram_users" ) . String ( )
if err := app . storage . loadTelegramUsers ( ) ; err != nil {
app . err . Printf ( "LegacyData: Failed to load Telegram users: %v" , err )
}
app . storage . discord_path = app . config . Section ( "files" ) . Key ( "discord_users" ) . String ( )
if err := app . storage . loadDiscordUsers ( ) ; err != nil {
app . err . Printf ( "LegacyData: Failed to load Discord users: %v" , err )
}
app . storage . matrix_path = app . config . Section ( "files" ) . Key ( "matrix_users" ) . String ( )
if err := app . storage . loadMatrixUsers ( ) ; err != nil {
app . err . Printf ( "LegacyData: Failed to load Matrix users: %v" , err )
}
app . storage . announcements_path = app . config . Section ( "files" ) . Key ( "announcements" ) . String ( )
if err := app . storage . loadAnnouncements ( ) ; err != nil {
app . err . Printf ( "LegacyData: Failed to load announcement templates: %v" , err )
}
app . storage . profiles_path = app . config . Section ( "files" ) . Key ( "user_profiles" ) . String ( )
app . storage . loadProfiles ( )
app . storage . customEmails_path = app . config . Section ( "files" ) . Key ( "custom_emails" ) . String ( )
app . storage . loadCustomEmails ( )
app . MustSetValue ( "user_page" , "enabled" , "true" )
if app . config . Section ( "user_page" ) . Key ( "enabled" ) . MustBool ( false ) {
app . storage . userPage_path = app . config . Section ( "files" ) . Key ( "custom_user_page_content" ) . String ( )
app . storage . loadUserPageContent ( )
}
}
2023-06-24 16:01:52 +00:00
func migrateToBadger ( app * appContext ) {
2023-06-25 18:59:11 +00:00
// Check the DB to see if we've already migrated
migrated := MigrationStatus { }
app . storage . db . Get ( "migrated_to_db" , & migrated )
if migrated . Done {
2023-06-24 18:13:05 +00:00
return
}
2023-06-24 16:01:52 +00:00
app . info . Println ( "Migrating to Badger(hold)" )
2023-06-25 19:15:15 +00:00
loadLegacyData ( app )
2023-06-24 18:13:05 +00:00
for k , v := range app . storage . deprecatedAnnouncements {
2023-06-24 16:01:52 +00:00
app . storage . SetAnnouncementsKey ( k , v )
}
2023-06-24 18:13:05 +00:00
for jfID , v := range app . storage . deprecatedDiscord {
2023-06-24 16:01:52 +00:00
app . storage . SetDiscordKey ( jfID , v )
}
2023-06-24 18:13:05 +00:00
for jfID , v := range app . storage . deprecatedTelegram {
2023-06-24 16:01:52 +00:00
app . storage . SetTelegramKey ( jfID , v )
}
2023-06-24 18:13:05 +00:00
for jfID , v := range app . storage . deprecatedMatrix {
2023-06-24 16:01:52 +00:00
app . storage . SetMatrixKey ( jfID , v )
}
2023-06-24 18:13:05 +00:00
for jfID , v := range app . storage . deprecatedEmails {
2023-06-24 16:01:52 +00:00
app . storage . SetEmailsKey ( jfID , v )
}
2023-06-24 18:13:05 +00:00
for k , v := range app . storage . deprecatedInvites {
app . storage . SetInvitesKey ( k , v )
}
for k , v := range app . storage . deprecatedUserExpiries {
app . storage . SetUserExpiryKey ( k , UserExpiry { Expiry : v } )
}
2023-06-24 20:29:16 +00:00
2023-06-24 20:31:22 +00:00
for k , v := range app . storage . deprecatedProfiles {
2023-06-26 11:57:16 +00:00
if v . Configuration . GroupedFolders != nil || len ( v . Displayprefs ) != 0 {
v . Homescreen = true
}
2023-06-24 20:29:16 +00:00
app . storage . SetProfileKey ( k , v )
}
2023-06-25 18:40:54 +00:00
if _ , ok := app . storage . GetCustomContentKey ( "UserCreated" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserCreated" , app . storage . deprecatedCustomEmails . UserCreated )
}
if _ , ok := app . storage . GetCustomContentKey ( "InviteExpiry" ) ; ! ok {
app . storage . SetCustomContentKey ( "InviteExpiry" , app . storage . deprecatedCustomEmails . InviteExpiry )
}
if _ , ok := app . storage . GetCustomContentKey ( "PasswordReset" ) ; ! ok {
app . storage . SetCustomContentKey ( "PasswordReset" , app . storage . deprecatedCustomEmails . PasswordReset )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserDeleted" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserDeleted" , app . storage . deprecatedCustomEmails . UserDeleted )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserDisabled" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserDisabled" , app . storage . deprecatedCustomEmails . UserDisabled )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserEnabled" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserEnabled" , app . storage . deprecatedCustomEmails . UserEnabled )
}
if _ , ok := app . storage . GetCustomContentKey ( "InviteEmail" ) ; ! ok {
app . storage . SetCustomContentKey ( "InviteEmail" , app . storage . deprecatedCustomEmails . InviteEmail )
}
if _ , ok := app . storage . GetCustomContentKey ( "WelcomeEmail" ) ; ! ok {
app . storage . SetCustomContentKey ( "WelcomeEmail" , app . storage . deprecatedCustomEmails . WelcomeEmail )
}
if _ , ok := app . storage . GetCustomContentKey ( "EmailConfirmation" ) ; ! ok {
app . storage . SetCustomContentKey ( "EmailConfirmation" , app . storage . deprecatedCustomEmails . EmailConfirmation )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserExpired" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserExpired" , app . storage . deprecatedCustomEmails . UserExpired )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserLogin" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserLogin" , app . storage . deprecatedUserPageContent . Login )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserPage" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserPage" , app . storage . deprecatedUserPageContent . Page )
}
2023-06-25 18:47:31 +00:00
2024-07-28 15:02:47 +00:00
// Custom content not present here was added post-badger.
2023-06-25 18:59:11 +00:00
err := app . storage . db . Upsert ( "migrated_to_db" , MigrationStatus { true } )
if err != nil {
app . err . Fatalf ( "Failed to migrate to DB: %v\n" , err )
}
2023-06-25 18:47:31 +00:00
app . info . Println ( "All data migrated to database. JSON files in the config folder can be deleted if you are sure all data is correct in the app. Create an issue if you have problems." )
2023-06-24 16:01:52 +00:00
}
2024-07-28 18:32:48 +00:00
// Simply creates an emply CC template if not in the DB already.
2024-07-28 15:02:47 +00:00
// Add new CC types here!
func intialiseCustomContent ( app * appContext ) {
emptyCC := CustomContent {
Enabled : false ,
}
if _ , ok := app . storage . GetCustomContentKey ( "UserCreated" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserCreated" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "InviteExpiry" ) ; ! ok {
app . storage . SetCustomContentKey ( "InviteExpiry" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "PasswordReset" ) ; ! ok {
app . storage . SetCustomContentKey ( "PasswordReset" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserDeleted" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserDeleted" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserDisabled" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserDisabled" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserEnabled" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserEnabled" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "InviteEmail" ) ; ! ok {
app . storage . SetCustomContentKey ( "InviteEmail" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "WelcomeEmail" ) ; ! ok {
app . storage . SetCustomContentKey ( "WelcomeEmail" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "EmailConfirmation" ) ; ! ok {
app . storage . SetCustomContentKey ( "EmailConfirmation" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserExpired" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserExpired" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserLogin" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserLogin" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserPage" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserPage" , emptyCC )
}
if _ , ok := app . storage . GetCustomContentKey ( "UserExpiryAdjusted" ) ; ! ok {
app . storage . SetCustomContentKey ( "UserExpiryAdjusted" , emptyCC )
}
2024-07-28 18:32:48 +00:00
if _ , ok := app . storage . GetCustomContentKey ( "PostSignupCard" ) ; ! ok {
app . storage . SetCustomContentKey ( "PostSignupCard" , emptyCC )
}
2024-07-28 15:02:47 +00:00
}
2021-06-01 13:18:49 +00:00
// Migrate between hyphenated & non-hyphenated user IDs. Doesn't seem to happen anymore, so disabled.
// func migrateHyphens(app *appContext) {
// checkVersion := func(version string) int {
// numberStrings := strings.Split(version, ".")
// n := 0
// for _, s := range numberStrings {
// num, err := strconv.Atoi(s)
// if err == nil {
// n += num
// }
// }
// return n
// }
// if serverType == mediabrowser.JellyfinServer && checkVersion(app.jf.ServerInfo.Version) >= checkVersion("10.7.0") {
// // Get users to check if server uses hyphenated userIDs
// app.jf.GetUsers(false)
//
// noHyphens := true
2023-06-24 16:01:52 +00:00
// for _, e := range app.storage.GetEmails() {
// if strings.Contains(e.JellyfinID, "-") {
2021-06-01 13:18:49 +00:00
// noHyphens = false
// break
// }
// }
// if noHyphens == app.jf.Hyphens {
// var newEmails map[string]interface{}
// var newUsers map[string]time.Time
// var status, status2 int
// var err, err2 error
// if app.jf.Hyphens {
// app.info.Println(info("Your build of Jellyfin appears to hypenate user IDs. Your emails.json/users.json file will be modified to match."))
// time.Sleep(time.Second * time.Duration(3))
// newEmails, status, err = app.hyphenateEmailStorage(app.storage.emails)
// newUsers, status2, err2 = app.hyphenateUserStorage(app.storage.users)
// } else {
// app.info.Println(info("Your emails.json/users.json file uses hyphens, but the Jellyfin server no longer does. It will be modified."))
// time.Sleep(time.Second * time.Duration(3))
// newEmails, status, err = app.deHyphenateEmailStorage(app.storage.emails)
// newUsers, status2, err2 = app.deHyphenateUserStorage(app.storage.users)
// }
// if status != 200 || err != nil {
// app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
// app.err.Fatalf("Couldn't upgrade emails.json")
// }
// if status2 != 200 || err2 != nil {
// app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
// app.err.Fatalf("Couldn't upgrade users.json")
// }
// emailBakFile := app.storage.emails_path + ".bak"
// usersBakFile := app.storage.users_path + ".bak"
// err = storeJSON(emailBakFile, app.storage.emails)
// err2 = storeJSON(usersBakFile, app.storage.users)
// if err != nil {
// app.err.Fatalf("couldn't store emails.json backup: %v", err)
// }
// if err2 != nil {
// app.err.Fatalf("couldn't store users.json backup: %v", err)
// }
// app.storage.emails = newEmails
// app.storage.users = newUsers
// err = app.storage.storeEmails()
2023-06-24 18:13:05 +00:00
// err2 = app.storage.storeUserExpiries()
2021-06-01 13:18:49 +00:00
// if err != nil {
// app.err.Fatalf("couldn't store emails.json: %v", err)
// }
// if err2 != nil {
// app.err.Fatalf("couldn't store users.json: %v", err)
// }
// }
// }
// }
2024-08-12 17:53:46 +00:00
// Migrate poorly-named and duplicate "url_base" settings to the single "external jfa-go URL" setting.
func migrateExternalURL ( app * appContext ) {
2024-08-20 19:19:32 +00:00
tempConfig , _ := ini . ShadowLoad ( app . configPath )
2024-08-12 17:53:46 +00:00
err := tempConfig . SaveTo ( app . configPath + "_" + commit + ".bak" )
if err != nil {
app . err . Fatalf ( "Failed to backup config: %v" , err )
return
}
url1 := app . config . Section ( "password_resets" ) . Key ( "url_base" ) . String ( )
url2 := app . config . Section ( "invite_emails" ) . Key ( "url_base" ) . String ( )
if tempConfig . Section ( "ui" ) . Key ( "jfa_url" ) . String ( ) != "" || ( url1 == "" && url2 == "" ) {
return
}
preferred := url1
// the PWR setting (url1) is preferred, as it has always been defined as the URL root, while
// the invite email setting (url2) once asked for "/invite" at the end.
if url1 == "" {
preferred = strings . TrimSuffix ( url2 , "/invite" )
}
fmt . Println ( warning ( "The duplicate URL Base settings in \"Invite emails\" and \"Password Resets\" have been merged into General > External jfa-go URL. A backup config has been made." ) )
tempConfig . Section ( "ui" ) . Key ( "jfa_url" ) . SetValue ( preferred )
app . config . Section ( "password_resets" ) . DeleteKey ( "url_base" )
app . config . Section ( "invite_emails" ) . DeleteKey ( "url_base" )
err = tempConfig . SaveTo ( app . configPath )
if err != nil {
app . err . Fatalf ( "Failed to save new config: %v" , err )
return
}
}