From 9db58dfd57784dee15c96b630bfbe74c991f518a Mon Sep 17 00:00:00 2001 From: tsmethurst Date: Tue, 8 Feb 2022 10:06:43 +0100 Subject: [PATCH] add comment explaining store.lock --- cmd/gotosocial/action/server/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/gotosocial/action/server/server.go b/cmd/gotosocial/action/server/server.go index ae43995e5..d71ef5b4f 100644 --- a/cmd/gotosocial/action/server/server.go +++ b/cmd/gotosocial/action/server/server.go @@ -102,7 +102,12 @@ var Start action.GTSAction = func(ctx context.Context) error { // Open the storage backend storageBasePath := viper.GetString(config.Keys.StorageLocalBasePath) storage, err := kv.OpenFile(storageBasePath, &storage.DiskConfig{ - LockFile: path.Join(storageBasePath, "store.lock"), // put the store lockfile in the storage dir itself + // Put the store lockfile in the storage dir itself. + // Normally this would not be safe, since we could end up + // overwriting the lockfile if we store a file called 'store.lock'. + // However, in this case it's OK because the keys are set by + // GtS and not the user, so we know we're never going to overwrite it. + LockFile: path.Join(storageBasePath, "store.lock"), }) if err != nil { return fmt.Errorf("error creating storage backend: %s", err)