Skip to content

BerryBytes/01cloud-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

01cloud-store

01cloud-store is a Go library that provides a single storage-facing API for platform metadata, workflow records, events, services, and related operational data across Firestore and MongoDB backends.

Build License Go Version

Why this project exists

Applications that need to persist CI/CD workflow data, cluster activity, service records, or environment state often end up tightly coupled to a single database implementation. This package keeps that persistence layer behind a consistent interface so consumers can switch between Firestore and MongoDB with environment-driven configuration.

Features

  • Unified StoreInterface for Firestore and MongoDB backends
  • Domain collections for CI workflows, cluster workflows, events, services, storage, cron jobs, release metadata, and more
  • fake package for tests and local development
  • Environment-based backend selection
  • Apache 2.0 licensed and ready for community contributions

Installation

Prerequisites

  • Go 1.13 or later
  • One configured backend:
    • Firestore with access to a Google Cloud project
    • MongoDB with a reachable connection URI

Add the dependency

go get github.com/berrybytes/01cloud-store@latest

Quick start

The package loads configuration from environment variables using .env support out of the box. Copy the example file and set values for the backend you want to use.

cp .env.example .env

Firestore configuration

export STORE_TYPE=firestore
export GCLOUD_PROJECT="your-gcp-project-id"
export GCLOUD_NAMESPACE="your-namespace"

MongoDB configuration

export STORE_TYPE=mongo
export MONGO_URL="mongodb://localhost:27017"
export MONGO_DB="cloud_store"

Example usage

package main

import (
	"log"

	store "github.com/berrybytes/01cloud-store"
)

func main() {
	s := store.NewStore()

	workflow, err := s.CIWOrkflow().GetWorkflow("example-workflow")
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("workflow: %#v", workflow)
}

Note: the current public API includes legacy method names such as CIWOrkflow() and ClusterWOrkflow(). They are documented here as-is to reflect the current exported surface.

Configuration

Variable Required Description
STORE_TYPE No Backend selector: firestore by default, or mongo
GCLOUD_PROJECT Firestore only Google Cloud project ID used to initialize the Firestore client
GCLOUD_NAMESPACE Firestore only Namespace or tenant scope used by Firestore queries
MONGO_URL Mongo only MongoDB connection URI
MONGO_DB Mongo only MongoDB database name

See .env.example for a working template.

Package layout

  • firestore/: Firestore-backed implementations
  • mongodb/: MongoDB-backed implementations
  • fake/: in-memory and fake helpers for tests
  • model/: shared domain models
  • constant/: collection names and constants

Development

Run tests

go test ./...

Run pre-commit checks

pip install pre-commit
pre-commit install
pre-commit run --all-files

To run a single hook:

pre-commit run gitleaks --all-files

Community

License

This project is licensed under the Apache License 2.0. See LICENSE.

About

01cloud-store is an open-source Go package that standardizes how platform and workflow data is stored, regardless of backend.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors