@@ -147,6 +147,7 @@ func main() {
147147 }
148148 return "" , false
149149 }
150+ writableBase := util .WritablePath ()
150151 if value , ok := lookupEnv ("PGSTORE_DSN" , "pgstore_dsn" ); ok {
151152 usePostgresStore = true
152153 pgStoreDSN = value
@@ -158,6 +159,13 @@ func main() {
158159 if value , ok := lookupEnv ("PGSTORE_LOCAL_PATH" , "pgstore_local_path" ); ok {
159160 pgStoreLocalPath = value
160161 }
162+ if pgStoreLocalPath == "" {
163+ if writableBase != "" {
164+ pgStoreLocalPath = writableBase
165+ } else {
166+ pgStoreLocalPath = wd
167+ }
168+ }
161169 useGitStore = false
162170 }
163171 if value , ok := lookupEnv ("GITSTORE_GIT_URL" , "gitstore_git_url" ); ok {
@@ -229,11 +237,14 @@ func main() {
229237 log .Infof ("postgres-backed token store enabled, workspace path: %s" , pgStoreInst .WorkDir ())
230238 }
231239 } else if useObjectStore {
232- objectStoreRoot := objectStoreLocalPath
233- if objectStoreRoot == "" {
234- objectStoreRoot = wd
240+ if objectStoreLocalPath == "" {
241+ if writableBase != "" {
242+ objectStoreLocalPath = writableBase
243+ } else {
244+ objectStoreLocalPath = wd
245+ }
235246 }
236- objectStoreRoot = filepath .Join (objectStoreRoot , "objectstore" )
247+ objectStoreRoot : = filepath .Join (objectStoreLocalPath , "objectstore" )
237248 resolvedEndpoint := strings .TrimSpace (objectStoreEndpoint )
238249 useSSL := true
239250 if strings .Contains (resolvedEndpoint , "://" ) {
@@ -289,7 +300,11 @@ func main() {
289300 }
290301 } else if useGitStore {
291302 if gitStoreLocalPath == "" {
292- gitStoreLocalPath = wd
303+ if writableBase != "" {
304+ gitStoreLocalPath = writableBase
305+ } else {
306+ gitStoreLocalPath = wd
307+ }
293308 }
294309 gitStoreRoot = filepath .Join (gitStoreLocalPath , "gitstore" )
295310 authDir := filepath .Join (gitStoreRoot , "auths" )
0 commit comments