From fbe614557f8828d10096998db814dc542d290458 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Tue, 29 Aug 2023 23:55:59 -0600 Subject: [PATCH] Store the state and database files in ~/.conda-store by default There is currently an issue where it is not able to access the database file correctly, which I am still figuring out. --- conda-store-server/conda_store_server/app.py | 5 +++-- conda-store-server/conda_store_server/server/app.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conda-store-server/conda_store_server/app.py b/conda-store-server/conda_store_server/app.py index ce7710981..2381f3943 100644 --- a/conda-store-server/conda_store_server/app.py +++ b/conda-store-server/conda_store_server/app.py @@ -1,6 +1,7 @@ import os import sys import datetime +from pathlib import Path, PosixPath from typing import Any, Dict from celery import Celery, group @@ -88,7 +89,7 @@ class CondaStore(LoggingConfigurable): ) store_directory = Unicode( - "conda-store-state", + str(Path.home() / ".conda-store" / "conda-store-state"), help="directory for conda-store to build environments and store state", config=True, ) @@ -201,7 +202,7 @@ class CondaStore(LoggingConfigurable): ) database_url = Unicode( - "sqlite:///conda-store.sqlite", + "sqlite:///" + str(PosixPath.home()) + "/.conda-store/conda-store.sqlite", help="url for the database. e.g. 'sqlite:///conda-store.sqlite' tables will be automatically created if they do not exist", config=True, ) diff --git a/conda-store-server/conda_store_server/server/app.py b/conda-store-server/conda_store_server/server/app.py index 741a31d26..13807b44a 100644 --- a/conda-store-server/conda_store_server/server/app.py +++ b/conda-store-server/conda_store_server/server/app.py @@ -183,6 +183,8 @@ def initialize(self, *args, **kwargs): self.conda_store = CondaStore(parent=self, log=self.log) + self.conda_store.ensure_directories() + if self.conda_store.upgrade_db: dbutil.upgrade(self.conda_store.database_url)