Struct grafbase_local_common::environment::Environment
source · pub struct Environment {
pub project_path: PathBuf,
pub project_dot_grafbase_path: PathBuf,
pub project_grafbase_path: PathBuf,
pub project_grafbase_schema_path: PathBuf,
pub user_dot_grafbase_path: PathBuf,
pub project_grafbase_registry_path: PathBuf,
}Expand description
a static representation of the current environment
must be initialized before use
Fields§
§project_path: PathBufthe path of the (assumed) user project root ($PROJECT), the nearest ancestor directory
with a grafbase/schema.graphql file
project_dot_grafbase_path: PathBufthe path of $PROJECT/.grafbase/, the Grafbase local developer tool cache and database directory,
in the nearest ancestor directory with grafbase/schema.graphql
project_grafbase_path: PathBufthe path of $PROJECT/grafbase/, the Grafbase schema directory in the nearest ancestor directory
with grafbase/schema.graphql
project_grafbase_schema_path: PathBufthe path of $PROJECT/grafbase/schema.graphql, the Grafbase schema,
in the nearest ancestor directory with said directory and file
user_dot_grafbase_path: PathBufthe path of $HOME/.grafbase, the user level local developer tool cache directory
project_grafbase_registry_path: PathBufthe path of $PROJECT/.grafbase/registry.json, the registry derived from schema.graphql,
in the nearest ancestor directory with a grabase/schema.graphql file
Implementations§
source§impl Environment
impl Environment
sourcepub fn try_init() -> Result<(), CommonError>
pub fn try_init() -> Result<(), CommonError>
initializes the static Environment instance
Errors
returns CommonError::ReadCurrentDirectory if the current directory path cannot be read
returns CommonError::FindGrafbaseDirectory if the grafbase directory is not found