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,
pub resolvers_source_path: PathBuf,
pub resolvers_build_artifact_path: PathBuf,
pub database_directory_path: PathBuf,
}
Expand description
a static representation of the current environment
must be initialized before use
Fields§
§project_path: PathBuf
the path of the (assumed) user project root ($PROJECT
), the nearest ancestor directory
with a grafbase/schema.graphql
file
project_dot_grafbase_path: PathBuf
the 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: PathBuf
the path of $PROJECT/grafbase/
, the Grafbase schema directory in the nearest ancestor directory
with grafbase/schema.graphql
project_grafbase_schema_path: PathBuf
the path of $PROJECT/grafbase/schema.graphql
, the Grafbase schema,
in the nearest ancestor directory with said directory and file
user_dot_grafbase_path: PathBuf
the path of $HOME/.grafbase
, the user level local developer tool cache directory
project_grafbase_registry_path: PathBuf
the path of $PROJECT/.grafbase/registry.json
, the registry derived from schema.graphql
,
in the nearest ancestor directory with a grabase/schema.graphql
file
resolvers_source_path: PathBuf
the path of the grafbase/resolvers
directory.
resolvers_build_artifact_path: PathBuf
the path within $PROJECT/.grafbase/
containing build artifacts for custom resolvers.
database_directory_path: PathBuf
the path within ‘$PROJECT/.grafbase’ containing the database
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