mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Rename app to Lemma
This commit is contained in:
2
.github/workflows/build-and-release.yml
vendored
2
.github/workflows/build-and-release.yml
vendored
@@ -8,7 +8,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
OWNER: lordmathis
|
OWNER: lordmathis
|
||||||
REPO: novamd
|
REPO: lemma
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-image:
|
build-and-push-image:
|
||||||
|
|||||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -2,7 +2,7 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Launch NovaMD Server",
|
"name": "Launch Lemma Server",
|
||||||
"type": "go",
|
"type": "go",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mode": "auto",
|
"mode": "auto",
|
||||||
|
|||||||
12
Dockerfile
12
Dockerfile
@@ -13,21 +13,21 @@ RUN apt-get update && apt-get install -y gcc musl-dev
|
|||||||
COPY server/go.mod server/go.sum ./
|
COPY server/go.mod server/go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY server .
|
COPY server .
|
||||||
RUN CGO_ENABLED=1 GOOS=linux go build -o novamd ./cmd/server
|
RUN CGO_ENABLED=1 GOOS=linux go build -o lemma ./cmd/server
|
||||||
|
|
||||||
# Stage 3: Final stage
|
# Stage 3: Final stage
|
||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=backend-builder /app/novamd .
|
COPY --from=backend-builder /app/lemma .
|
||||||
COPY --from=frontend-builder /app/dist ./dist
|
COPY --from=frontend-builder /app/dist ./dist
|
||||||
|
|
||||||
RUN mkdir -p /app/data
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
# Set default environment variables
|
# Set default environment variables
|
||||||
ENV NOVAMD_STATIC_PATH=/app/dist
|
ENV LEMMA_STATIC_PATH=/app/dist
|
||||||
ENV NOVAMD_PORT=8080
|
ENV LEMMA_PORT=8080
|
||||||
ENV NOVAMD_WORKDIR=/app/data
|
ENV LEMMA_WORKDIR=/app/data
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["./novamd"]
|
CMD ["./lemma"]
|
||||||
42
README.md
42
README.md
@@ -1,6 +1,6 @@
|
|||||||
# NovaMD
|
# Lemma
|
||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
Yet another markdown editor. Work in progress
|
Yet another markdown editor. Work in progress
|
||||||
|
|
||||||
@@ -22,26 +22,26 @@ Yet another markdown editor. Work in progress
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
NovaMD can be configured using environment variables. Here are the available configuration options:
|
Lemma can be configured using environment variables. Here are the available configuration options:
|
||||||
|
|
||||||
### Required Environment Variables
|
### Required Environment Variables
|
||||||
|
|
||||||
- `NOVAMD_ADMIN_EMAIL`: Email address for the admin account
|
- `LEMMA_ADMIN_EMAIL`: Email address for the admin account
|
||||||
- `NOVAMD_ADMIN_PASSWORD`: Password for the admin account
|
- `LEMMA_ADMIN_PASSWORD`: Password for the admin account
|
||||||
- `NOVAMD_ENCRYPTION_KEY`: Base64-encoded 32-byte key used for encrypting sensitive data
|
- `LEMMA_ENCRYPTION_KEY`: Base64-encoded 32-byte key used for encrypting sensitive data
|
||||||
|
|
||||||
### Optional Environment Variables
|
### Optional Environment Variables
|
||||||
|
|
||||||
- `NOVAMD_ENV`: Set to "development" to enable development mode
|
- `LEMMA_ENV`: Set to "development" to enable development mode
|
||||||
- `NOVAMD_DB_PATH`: Path to the SQLite database file (default: "./novamd.db")
|
- `LEMMA_DB_PATH`: Path to the SQLite database file (default: "./lemma.db")
|
||||||
- `NOVAMD_WORKDIR`: Working directory for application data (default: "./data")
|
- `LEMMA_WORKDIR`: Working directory for application data (default: "./data")
|
||||||
- `NOVAMD_STATIC_PATH`: Path to static files (default: "../app/dist")
|
- `LEMMA_STATIC_PATH`: Path to static files (default: "../app/dist")
|
||||||
- `NOVAMD_PORT`: Port to run the server on (default: "8080")
|
- `LEMMA_PORT`: Port to run the server on (default: "8080")
|
||||||
- `NOVAMD_APP_URL`: Full URL where the application is hosted
|
- `LEMMA_APP_URL`: Full URL where the application is hosted
|
||||||
- `NOVAMD_CORS_ORIGINS`: Comma-separated list of allowed CORS origins
|
- `LEMMA_CORS_ORIGINS`: Comma-separated list of allowed CORS origins
|
||||||
- `NOVAMD_JWT_SIGNING_KEY`: Key used for signing JWT tokens (autogenerated if not set)
|
- `LEMMA_JWT_SIGNING_KEY`: Key used for signing JWT tokens (autogenerated if not set)
|
||||||
- `NOVAMD_RATE_LIMIT_REQUESTS`: Number of allowed requests per window (default: 100)
|
- `LEMMA_RATE_LIMIT_REQUESTS`: Number of allowed requests per window (default: 100)
|
||||||
- `NOVAMD_RATE_LIMIT_WINDOW`: Duration of the rate limit window (default: 15m)
|
- `LEMMA_RATE_LIMIT_WINDOW`: Duration of the rate limit window (default: 15m)
|
||||||
|
|
||||||
### Generating Encryption Keys
|
### Generating Encryption Keys
|
||||||
|
|
||||||
@@ -88,10 +88,10 @@ Store the generated key securely - it will be needed to decrypt any data encrypt
|
|||||||
2. Build the backend:
|
2. Build the backend:
|
||||||
```
|
```
|
||||||
cd server
|
cd server
|
||||||
go build -o novamd ./cmd/server
|
go build -o lemma ./cmd/server
|
||||||
```
|
```
|
||||||
3. Set the `NOVAMD_STATIC_PATH` environment variable to point to the frontend build directory
|
3. Set the `LEMMA_STATIC_PATH` environment variable to point to the frontend build directory
|
||||||
4. Run the `novamd` executable
|
4. Run the `lemma` executable
|
||||||
|
|
||||||
## Docker Support
|
## Docker Support
|
||||||
|
|
||||||
@@ -99,11 +99,11 @@ A Dockerfile is provided for easy deployment. To build and run the Docker image:
|
|||||||
|
|
||||||
1. Build the image:
|
1. Build the image:
|
||||||
```
|
```
|
||||||
docker build -t novamd .
|
docker build -t lemma .
|
||||||
```
|
```
|
||||||
2. Run the container:
|
2. Run the container:
|
||||||
```
|
```
|
||||||
docker run -p 8080:8080 -v /path/to/data:/app/data novamd
|
docker run -p 8080:8080 -v /path/to/data:/app/data lemma
|
||||||
```
|
```
|
||||||
|
|
||||||
## Upgrading
|
## Upgrading
|
||||||
|
|||||||
10
app/package-lock.json
generated
10
app/package-lock.json
generated
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "novamd-frontend",
|
"name": "lemma-frontend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "novamd-frontend",
|
"name": "lemma-frontend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -4170,9 +4170,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/nanoid": {
|
"node_modules/nanoid": {
|
||||||
"version": "3.3.7",
|
"version": "3.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
|
||||||
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "novamd-frontend",
|
"name": "lemma-frontend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Yet another markdown editor",
|
"description": "Yet another markdown editor",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/LordMathis/NovaMD.git"
|
"url": "git+https://github.com/LordMathis/Lemma.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"markdown",
|
"markdown",
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
"author": "Matúš Námešný",
|
"author": "Matúš Námešný",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/LordMathis/NovaMD/issues"
|
"url": "https://github.com/LordMathis/Lemma/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/LordMathis/NovaMD#readme",
|
"homepage": "https://github.com/LordMathis/Lemma#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/commands": "^6.6.2",
|
"@codemirror/commands": "^6.6.2",
|
||||||
"@codemirror/lang-markdown": "^6.2.5",
|
"@codemirror/lang-markdown": "^6.2.5",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const LoginPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Container size={420} my={40}>
|
<Container size={420} my={40}>
|
||||||
<Title ta="center">Welcome to NovaMD</Title>
|
<Title ta="center">Welcome to Lemma</Title>
|
||||||
<Text c="dimmed" size="sm" ta="center" mt={5}>
|
<Text c="dimmed" size="sm" ta="center" mt={5}>
|
||||||
Please sign in to continue
|
Please sign in to continue
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const Header = () => {
|
|||||||
return (
|
return (
|
||||||
<Group justify="space-between" h={60} px="md">
|
<Group justify="space-between" h={60} px="md">
|
||||||
<Text fw={700} size="lg">
|
<Text fw={700} size="lg">
|
||||||
NovaMD
|
Lemma
|
||||||
</Text>
|
</Text>
|
||||||
<Group>
|
<Group>
|
||||||
<WorkspaceSwitcher />
|
<WorkspaceSwitcher />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>NovaMD</title>
|
<title>Lemma</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const DEFAULT_WORKSPACE = {
|
|||||||
export const DEFAULT_FILE = {
|
export const DEFAULT_FILE = {
|
||||||
name: 'New File.md',
|
name: 'New File.md',
|
||||||
path: 'New File.md',
|
path: 'New File.md',
|
||||||
content: '# Welcome to NovaMD\n\nStart editing here!',
|
content: '# Welcome to Lemma\n\nStart editing here!',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MARKDOWN_REGEX = {
|
export const MARKDOWN_REGEX = {
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ package main
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"novamd/internal/app"
|
"lemma/internal/app"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @title NovaMD API
|
// @title Lemma API
|
||||||
// @version 1.0
|
// @version 1.0
|
||||||
// @description This is the API for NovaMD markdown note taking app.
|
// @description This is the API for Lemma markdown note taking app.
|
||||||
// @license.name Apache 2.0
|
// @license.name Apache 2.0
|
||||||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
// @BasePath /api/v1
|
// @BasePath /api/v1
|
||||||
|
|||||||
@@ -1295,7 +1295,7 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"500": {
|
"500": {
|
||||||
"description": "Failed to write response",
|
"description": "Failed to delete file",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
||||||
}
|
}
|
||||||
@@ -1777,8 +1777,8 @@ var SwaggerInfo = &swag.Spec{
|
|||||||
Host: "",
|
Host: "",
|
||||||
BasePath: "/api/v1",
|
BasePath: "/api/v1",
|
||||||
Schemes: []string{},
|
Schemes: []string{},
|
||||||
Title: "NovaMD API",
|
Title: "Lemma API",
|
||||||
Description: "This is the API for NovaMD markdown note taking app.",
|
Description: "This is the API for Lemma markdown note taking app.",
|
||||||
InfoInstanceName: "swagger",
|
InfoInstanceName: "swagger",
|
||||||
SwaggerTemplate: docTemplate,
|
SwaggerTemplate: docTemplate,
|
||||||
LeftDelim: "{{",
|
LeftDelim: "{{",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"description": "This is the API for NovaMD markdown note taking app.",
|
"description": "This is the API for Lemma markdown note taking app.",
|
||||||
"title": "NovaMD API",
|
"title": "Lemma API",
|
||||||
"contact": {},
|
"contact": {},
|
||||||
"license": {
|
"license": {
|
||||||
"name": "Apache 2.0",
|
"name": "Apache 2.0",
|
||||||
@@ -1288,7 +1288,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"500": {
|
"500": {
|
||||||
"description": "Failed to write response",
|
"description": "Failed to delete file",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
"$ref": "#/definitions/handlers.ErrorResponse"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,11 +239,11 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
info:
|
info:
|
||||||
contact: {}
|
contact: {}
|
||||||
description: This is the API for NovaMD markdown note taking app.
|
description: This is the API for Lemma markdown note taking app.
|
||||||
license:
|
license:
|
||||||
name: Apache 2.0
|
name: Apache 2.0
|
||||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
title: NovaMD API
|
title: Lemma API
|
||||||
version: "1.0"
|
version: "1.0"
|
||||||
paths:
|
paths:
|
||||||
/admin/stats:
|
/admin/stats:
|
||||||
@@ -844,7 +844,7 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/handlers.ErrorResponse'
|
$ref: '#/definitions/handlers.ErrorResponse'
|
||||||
"500":
|
"500":
|
||||||
description: Failed to write response
|
description: Failed to delete file
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/handlers.ErrorResponse'
|
$ref: '#/definitions/handlers.ErrorResponse'
|
||||||
security:
|
security:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# NovaMD Package Documentation
|
# Lemma Package Documentation
|
||||||
|
|
||||||
Generated documentation for all packages in the NovaMD project.
|
Generated documentation for all packages in the Lemma project.
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ configuration, initializes the server, and starts the server.
|
|||||||
## docs
|
## docs
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package docs // import "novamd/docs"
|
package docs // import "lemma/docs"
|
||||||
|
|
||||||
Package docs Code generated by swaggo/swag. DO NOT EDIT
|
Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||||
|
|
||||||
@@ -37,8 +37,8 @@ var SwaggerInfo = &swag.Spec{
|
|||||||
Host: "",
|
Host: "",
|
||||||
BasePath: "/api/v1",
|
BasePath: "/api/v1",
|
||||||
Schemes: []string{},
|
Schemes: []string{},
|
||||||
Title: "NovaMD API",
|
Title: "Lemma API",
|
||||||
Description: "This is the API for NovaMD markdown note taking app.",
|
Description: "This is the API for Lemma markdown note taking app.",
|
||||||
InfoInstanceName: "swagger",
|
InfoInstanceName: "swagger",
|
||||||
SwaggerTemplate: docTemplate,
|
SwaggerTemplate: docTemplate,
|
||||||
LeftDelim: "{{",
|
LeftDelim: "{{",
|
||||||
@@ -51,7 +51,7 @@ var SwaggerInfo = &swag.Spec{
|
|||||||
## internal/app
|
## internal/app
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package app // import "novamd/internal/app"
|
package app // import "lemma/internal/app"
|
||||||
|
|
||||||
Package app provides application-level functionality for initializing and
|
Package app provides application-level functionality for initializing and
|
||||||
running the server
|
running the server
|
||||||
@@ -118,7 +118,7 @@ func (s *Server) Start() error
|
|||||||
## internal/auth
|
## internal/auth
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package auth // import "novamd/internal/auth"
|
package auth // import "lemma/internal/auth"
|
||||||
|
|
||||||
Package auth provides JWT token generation and validation
|
Package auth provides JWT token generation and validation
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ const (
|
|||||||
## internal/context
|
## internal/context
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package context // import "novamd/internal/context"
|
package context // import "lemma/internal/context"
|
||||||
|
|
||||||
Package context provides functions for managing request context
|
Package context provides functions for managing request context
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ func GetUserFromContext(ctx context.Context) (*UserClaims, error)
|
|||||||
## internal/db
|
## internal/db
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package db // import "novamd/internal/db"
|
package db // import "lemma/internal/db"
|
||||||
|
|
||||||
Package db provides the database access layer for the application. It contains
|
Package db provides the database access layer for the application. It contains
|
||||||
methods for interacting with the database, such as creating, updating, and
|
methods for interacting with the database, such as creating, updating, and
|
||||||
@@ -369,7 +369,7 @@ type WorkspaceWriter interface {
|
|||||||
## internal/git
|
## internal/git
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package git // import "novamd/internal/git"
|
package git // import "lemma/internal/git"
|
||||||
|
|
||||||
Package git provides functionalities to interact with Git repositories,
|
Package git provides functionalities to interact with Git repositories,
|
||||||
including cloning, pulling, committing, and pushing changes.
|
including cloning, pulling, committing, and pushing changes.
|
||||||
@@ -409,7 +409,7 @@ type Config struct {
|
|||||||
## internal/handlers
|
## internal/handlers
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package handlers // import "novamd/internal/handlers"
|
package handlers // import "lemma/internal/handlers"
|
||||||
|
|
||||||
Package handlers contains the request handlers for the api routes.
|
Package handlers contains the request handlers for the api routes.
|
||||||
|
|
||||||
@@ -825,7 +825,7 @@ type WorkspaceStats struct {
|
|||||||
## internal/models
|
## internal/models
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package models // import "novamd/internal/models"
|
package models // import "lemma/internal/models"
|
||||||
|
|
||||||
Package models contains the data models used throughout the application.
|
Package models contains the data models used throughout the application.
|
||||||
These models are used to represent data in the database, as well as to validate
|
These models are used to represent data in the database, as well as to validate
|
||||||
@@ -902,7 +902,7 @@ func (w *Workspace) ValidateGitSettings() error
|
|||||||
## internal/secrets
|
## internal/secrets
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package secrets // import "novamd/internal/secrets"
|
package secrets // import "lemma/internal/secrets"
|
||||||
|
|
||||||
Package secrets provides an Encryptor interface for encrypting and decrypting
|
Package secrets provides an Encryptor interface for encrypting and decrypting
|
||||||
strings using AES-256-GCM.
|
strings using AES-256-GCM.
|
||||||
@@ -931,7 +931,7 @@ func NewService(key string) (Service, error)
|
|||||||
## internal/storage
|
## internal/storage
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package storage // import "novamd/internal/storage"
|
package storage // import "lemma/internal/storage"
|
||||||
|
|
||||||
Package storage provides functionalities to interact with the file system,
|
Package storage provides functionalities to interact with the file system,
|
||||||
including listing files, finding files by name, getting file content, saving
|
including listing files, finding files by name, getting file content, saving
|
||||||
@@ -1091,4 +1091,3 @@ type WorkspaceManager interface {
|
|||||||
storage.
|
storage.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ generate_anchor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create documentation file
|
# Create documentation file
|
||||||
echo "# NovaMD Package Documentation
|
echo "# Lemma Package Documentation
|
||||||
|
|
||||||
Generated documentation for all packages in the NovaMD project.
|
Generated documentation for all packages in the Lemma project.
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
" > documentation.md
|
" > documentation.md
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module novamd
|
module lemma
|
||||||
|
|
||||||
go 1.23.1
|
go 1.23.1
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package app
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"novamd/internal/secrets"
|
"lemma/internal/secrets"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -32,7 +32,7 @@ type Config struct {
|
|||||||
// DefaultConfig returns a new Config instance with default values
|
// DefaultConfig returns a new Config instance with default values
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
DBPath: "./novamd.db",
|
DBPath: "./lemma.db",
|
||||||
WorkDir: "./data",
|
WorkDir: "./data",
|
||||||
StaticPath: "../app/dist",
|
StaticPath: "../app/dist",
|
||||||
Port: "8080",
|
Port: "8080",
|
||||||
@@ -45,12 +45,12 @@ func DefaultConfig() *Config {
|
|||||||
// validate checks if the configuration is valid
|
// validate checks if the configuration is valid
|
||||||
func (c *Config) validate() error {
|
func (c *Config) validate() error {
|
||||||
if c.AdminEmail == "" || c.AdminPassword == "" {
|
if c.AdminEmail == "" || c.AdminPassword == "" {
|
||||||
return fmt.Errorf("NOVAMD_ADMIN_EMAIL and NOVAMD_ADMIN_PASSWORD must be set")
|
return fmt.Errorf("LEMMA_ADMIN_EMAIL and LEMMA_ADMIN_PASSWORD must be set")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate encryption key
|
// Validate encryption key
|
||||||
if err := secrets.ValidateKey(c.EncryptionKey); err != nil {
|
if err := secrets.ValidateKey(c.EncryptionKey); err != nil {
|
||||||
return fmt.Errorf("invalid NOVAMD_ENCRYPTION_KEY: %w", err)
|
return fmt.Errorf("invalid LEMMA_ENCRYPTION_KEY: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -70,52 +70,52 @@ func (c *Config) Redact() *Config {
|
|||||||
func LoadConfig() (*Config, error) {
|
func LoadConfig() (*Config, error) {
|
||||||
config := DefaultConfig()
|
config := DefaultConfig()
|
||||||
|
|
||||||
if env := os.Getenv("NOVAMD_ENV"); env != "" {
|
if env := os.Getenv("LEMMA_ENV"); env != "" {
|
||||||
config.IsDevelopment = env == "development"
|
config.IsDevelopment = env == "development"
|
||||||
}
|
}
|
||||||
|
|
||||||
if dbPath := os.Getenv("NOVAMD_DB_PATH"); dbPath != "" {
|
if dbPath := os.Getenv("LEMMA_DB_PATH"); dbPath != "" {
|
||||||
config.DBPath = dbPath
|
config.DBPath = dbPath
|
||||||
}
|
}
|
||||||
|
|
||||||
if workDir := os.Getenv("NOVAMD_WORKDIR"); workDir != "" {
|
if workDir := os.Getenv("LEMMA_WORKDIR"); workDir != "" {
|
||||||
config.WorkDir = workDir
|
config.WorkDir = workDir
|
||||||
}
|
}
|
||||||
|
|
||||||
if staticPath := os.Getenv("NOVAMD_STATIC_PATH"); staticPath != "" {
|
if staticPath := os.Getenv("LEMMA_STATIC_PATH"); staticPath != "" {
|
||||||
config.StaticPath = staticPath
|
config.StaticPath = staticPath
|
||||||
}
|
}
|
||||||
|
|
||||||
if port := os.Getenv("NOVAMD_PORT"); port != "" {
|
if port := os.Getenv("LEMMA_PORT"); port != "" {
|
||||||
config.Port = port
|
config.Port = port
|
||||||
}
|
}
|
||||||
|
|
||||||
if rootURL := os.Getenv("NOVAMD_ROOT_URL"); rootURL != "" {
|
if rootURL := os.Getenv("LEMMA_ROOT_URL"); rootURL != "" {
|
||||||
config.RootURL = rootURL
|
config.RootURL = rootURL
|
||||||
}
|
}
|
||||||
|
|
||||||
if domain := os.Getenv("NOVAMD_DOMAIN"); domain != "" {
|
if domain := os.Getenv("LEMMA_DOMAIN"); domain != "" {
|
||||||
config.Domain = domain
|
config.Domain = domain
|
||||||
}
|
}
|
||||||
|
|
||||||
if corsOrigins := os.Getenv("NOVAMD_CORS_ORIGINS"); corsOrigins != "" {
|
if corsOrigins := os.Getenv("LEMMA_CORS_ORIGINS"); corsOrigins != "" {
|
||||||
config.CORSOrigins = strings.Split(corsOrigins, ",")
|
config.CORSOrigins = strings.Split(corsOrigins, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
config.AdminEmail = os.Getenv("NOVAMD_ADMIN_EMAIL")
|
config.AdminEmail = os.Getenv("LEMMA_ADMIN_EMAIL")
|
||||||
config.AdminPassword = os.Getenv("NOVAMD_ADMIN_PASSWORD")
|
config.AdminPassword = os.Getenv("LEMMA_ADMIN_PASSWORD")
|
||||||
config.EncryptionKey = os.Getenv("NOVAMD_ENCRYPTION_KEY")
|
config.EncryptionKey = os.Getenv("LEMMA_ENCRYPTION_KEY")
|
||||||
config.JWTSigningKey = os.Getenv("NOVAMD_JWT_SIGNING_KEY")
|
config.JWTSigningKey = os.Getenv("LEMMA_JWT_SIGNING_KEY")
|
||||||
|
|
||||||
// Configure rate limiting
|
// Configure rate limiting
|
||||||
if reqStr := os.Getenv("NOVAMD_RATE_LIMIT_REQUESTS"); reqStr != "" {
|
if reqStr := os.Getenv("LEMMA_RATE_LIMIT_REQUESTS"); reqStr != "" {
|
||||||
parsed, err := strconv.Atoi(reqStr)
|
parsed, err := strconv.Atoi(reqStr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
config.RateLimitRequests = parsed
|
config.RateLimitRequests = parsed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if windowStr := os.Getenv("NOVAMD_RATE_LIMIT_WINDOW"); windowStr != "" {
|
if windowStr := os.Getenv("LEMMA_RATE_LIMIT_WINDOW"); windowStr != "" {
|
||||||
parsed, err := time.ParseDuration(windowStr)
|
parsed, err := time.ParseDuration(windowStr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
config.RateLimitWindow = parsed
|
config.RateLimitWindow = parsed
|
||||||
@@ -123,7 +123,7 @@ func LoadConfig() (*Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure log level, if isDevelopment is set, default to debug
|
// Configure log level, if isDevelopment is set, default to debug
|
||||||
if logLevel := os.Getenv("NOVAMD_LOG_LEVEL"); logLevel != "" {
|
if logLevel := os.Getenv("LEMMA_LOG_LEVEL"); logLevel != "" {
|
||||||
parsed := logging.ParseLogLevel(logLevel)
|
parsed := logging.ParseLogLevel(logLevel)
|
||||||
config.LogLevel = parsed
|
config.LogLevel = parsed
|
||||||
} else if config.IsDevelopment {
|
} else if config.IsDevelopment {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package app_test
|
package app_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"novamd/internal/app"
|
"lemma/internal/app"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDefaultConfig(t *testing.T) {
|
func TestDefaultConfig(t *testing.T) {
|
||||||
@@ -17,7 +17,7 @@ func TestDefaultConfig(t *testing.T) {
|
|||||||
got interface{}
|
got interface{}
|
||||||
expected interface{}
|
expected interface{}
|
||||||
}{
|
}{
|
||||||
{"DBPath", cfg.DBPath, "./novamd.db"},
|
{"DBPath", cfg.DBPath, "./lemma.db"},
|
||||||
{"WorkDir", cfg.WorkDir, "./data"},
|
{"WorkDir", cfg.WorkDir, "./data"},
|
||||||
{"StaticPath", cfg.StaticPath, "../app/dist"},
|
{"StaticPath", cfg.StaticPath, "../app/dist"},
|
||||||
{"Port", cfg.Port, "8080"},
|
{"Port", cfg.Port, "8080"},
|
||||||
@@ -46,20 +46,20 @@ func TestLoad(t *testing.T) {
|
|||||||
// Helper function to reset environment variables
|
// Helper function to reset environment variables
|
||||||
cleanup := func() {
|
cleanup := func() {
|
||||||
envVars := []string{
|
envVars := []string{
|
||||||
"NOVAMD_ENV",
|
"LEMMA_ENV",
|
||||||
"NOVAMD_DB_PATH",
|
"LEMMA_DB_PATH",
|
||||||
"NOVAMD_WORKDIR",
|
"LEMMA_WORKDIR",
|
||||||
"NOVAMD_STATIC_PATH",
|
"LEMMA_STATIC_PATH",
|
||||||
"NOVAMD_PORT",
|
"LEMMA_PORT",
|
||||||
"NOVAMD_ROOT_URL",
|
"LEMMA_ROOT_URL",
|
||||||
"NOVAMD_DOMAIN",
|
"LEMMA_DOMAIN",
|
||||||
"NOVAMD_CORS_ORIGINS",
|
"LEMMA_CORS_ORIGINS",
|
||||||
"NOVAMD_ADMIN_EMAIL",
|
"LEMMA_ADMIN_EMAIL",
|
||||||
"NOVAMD_ADMIN_PASSWORD",
|
"LEMMA_ADMIN_PASSWORD",
|
||||||
"NOVAMD_ENCRYPTION_KEY",
|
"LEMMA_ENCRYPTION_KEY",
|
||||||
"NOVAMD_JWT_SIGNING_KEY",
|
"LEMMA_JWT_SIGNING_KEY",
|
||||||
"NOVAMD_RATE_LIMIT_REQUESTS",
|
"LEMMA_RATE_LIMIT_REQUESTS",
|
||||||
"NOVAMD_RATE_LIMIT_WINDOW",
|
"LEMMA_RATE_LIMIT_WINDOW",
|
||||||
}
|
}
|
||||||
for _, env := range envVars {
|
for _, env := range envVars {
|
||||||
if err := os.Unsetenv(env); err != nil {
|
if err := os.Unsetenv(env); err != nil {
|
||||||
@@ -73,17 +73,17 @@ func TestLoad(t *testing.T) {
|
|||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
// Set required env vars
|
// Set required env vars
|
||||||
setEnv(t, "NOVAMD_ADMIN_EMAIL", "admin@example.com")
|
setEnv(t, "LEMMA_ADMIN_EMAIL", "admin@example.com")
|
||||||
setEnv(t, "NOVAMD_ADMIN_PASSWORD", "password123")
|
setEnv(t, "LEMMA_ADMIN_PASSWORD", "password123")
|
||||||
setEnv(t, "NOVAMD_ENCRYPTION_KEY", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=") // 32 bytes base64 encoded
|
setEnv(t, "LEMMA_ENCRYPTION_KEY", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=") // 32 bytes base64 encoded
|
||||||
|
|
||||||
cfg, err := app.LoadConfig()
|
cfg, err := app.LoadConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Load() error = %v", err)
|
t.Fatalf("Load() error = %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.DBPath != "./novamd.db" {
|
if cfg.DBPath != "./lemma.db" {
|
||||||
t.Errorf("default DBPath = %v, want %v", cfg.DBPath, "./novamd.db")
|
t.Errorf("default DBPath = %v, want %v", cfg.DBPath, "./lemma.db")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -93,19 +93,19 @@ func TestLoad(t *testing.T) {
|
|||||||
|
|
||||||
// Set all environment variables
|
// Set all environment variables
|
||||||
envs := map[string]string{
|
envs := map[string]string{
|
||||||
"NOVAMD_ENV": "development",
|
"LEMMA_ENV": "development",
|
||||||
"NOVAMD_DB_PATH": "/custom/db/path.db",
|
"LEMMA_DB_PATH": "/custom/db/path.db",
|
||||||
"NOVAMD_WORKDIR": "/custom/work/dir",
|
"LEMMA_WORKDIR": "/custom/work/dir",
|
||||||
"NOVAMD_STATIC_PATH": "/custom/static/path",
|
"LEMMA_STATIC_PATH": "/custom/static/path",
|
||||||
"NOVAMD_PORT": "3000",
|
"LEMMA_PORT": "3000",
|
||||||
"NOVAMD_ROOT_URL": "http://localhost:3000",
|
"LEMMA_ROOT_URL": "http://localhost:3000",
|
||||||
"NOVAMD_CORS_ORIGINS": "http://localhost:3000,http://localhost:3001",
|
"LEMMA_CORS_ORIGINS": "http://localhost:3000,http://localhost:3001",
|
||||||
"NOVAMD_ADMIN_EMAIL": "admin@example.com",
|
"LEMMA_ADMIN_EMAIL": "admin@example.com",
|
||||||
"NOVAMD_ADMIN_PASSWORD": "password123",
|
"LEMMA_ADMIN_PASSWORD": "password123",
|
||||||
"NOVAMD_ENCRYPTION_KEY": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=",
|
"LEMMA_ENCRYPTION_KEY": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=",
|
||||||
"NOVAMD_JWT_SIGNING_KEY": "secret-key",
|
"LEMMA_JWT_SIGNING_KEY": "secret-key",
|
||||||
"NOVAMD_RATE_LIMIT_REQUESTS": "200",
|
"LEMMA_RATE_LIMIT_REQUESTS": "200",
|
||||||
"NOVAMD_RATE_LIMIT_WINDOW": "30m",
|
"LEMMA_RATE_LIMIT_WINDOW": "30m",
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range envs {
|
for k, v := range envs {
|
||||||
@@ -165,38 +165,38 @@ func TestLoad(t *testing.T) {
|
|||||||
name: "missing admin email",
|
name: "missing admin email",
|
||||||
setupEnv: func(t *testing.T) {
|
setupEnv: func(t *testing.T) {
|
||||||
cleanup()
|
cleanup()
|
||||||
setEnv(t, "NOVAMD_ADMIN_PASSWORD", "password123")
|
setEnv(t, "LEMMA_ADMIN_PASSWORD", "password123")
|
||||||
setEnv(t, "NOVAMD_ENCRYPTION_KEY", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=")
|
setEnv(t, "LEMMA_ENCRYPTION_KEY", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=")
|
||||||
},
|
},
|
||||||
expectedError: "NOVAMD_ADMIN_EMAIL and NOVAMD_ADMIN_PASSWORD must be set",
|
expectedError: "LEMMA_ADMIN_EMAIL and LEMMA_ADMIN_PASSWORD must be set",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "missing admin password",
|
name: "missing admin password",
|
||||||
setupEnv: func(t *testing.T) {
|
setupEnv: func(t *testing.T) {
|
||||||
cleanup()
|
cleanup()
|
||||||
setEnv(t, "NOVAMD_ADMIN_EMAIL", "admin@example.com")
|
setEnv(t, "LEMMA_ADMIN_EMAIL", "admin@example.com")
|
||||||
setEnv(t, "NOVAMD_ENCRYPTION_KEY", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=")
|
setEnv(t, "LEMMA_ENCRYPTION_KEY", "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=")
|
||||||
},
|
},
|
||||||
expectedError: "NOVAMD_ADMIN_EMAIL and NOVAMD_ADMIN_PASSWORD must be set",
|
expectedError: "LEMMA_ADMIN_EMAIL and LEMMA_ADMIN_PASSWORD must be set",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "missing encryption key",
|
name: "missing encryption key",
|
||||||
setupEnv: func(t *testing.T) {
|
setupEnv: func(t *testing.T) {
|
||||||
cleanup()
|
cleanup()
|
||||||
setEnv(t, "NOVAMD_ADMIN_EMAIL", "admin@example.com")
|
setEnv(t, "LEMMA_ADMIN_EMAIL", "admin@example.com")
|
||||||
setEnv(t, "NOVAMD_ADMIN_PASSWORD", "password123")
|
setEnv(t, "LEMMA_ADMIN_PASSWORD", "password123")
|
||||||
},
|
},
|
||||||
expectedError: "invalid NOVAMD_ENCRYPTION_KEY: encryption key is required",
|
expectedError: "invalid LEMMA_ENCRYPTION_KEY: encryption key is required",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid encryption key",
|
name: "invalid encryption key",
|
||||||
setupEnv: func(t *testing.T) {
|
setupEnv: func(t *testing.T) {
|
||||||
cleanup()
|
cleanup()
|
||||||
setEnv(t, "NOVAMD_ADMIN_EMAIL", "admin@example.com")
|
setEnv(t, "LEMMA_ADMIN_EMAIL", "admin@example.com")
|
||||||
setEnv(t, "NOVAMD_ADMIN_PASSWORD", "password123")
|
setEnv(t, "LEMMA_ADMIN_PASSWORD", "password123")
|
||||||
setEnv(t, "NOVAMD_ENCRYPTION_KEY", "invalid-key")
|
setEnv(t, "LEMMA_ENCRYPTION_KEY", "invalid-key")
|
||||||
},
|
},
|
||||||
expectedError: "invalid NOVAMD_ENCRYPTION_KEY: invalid base64 encoding: illegal base64 data at input byte 7",
|
expectedError: "invalid LEMMA_ENCRYPTION_KEY: invalid base64 encoding: illegal base64 data at input byte 7",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"novamd/internal/auth"
|
"lemma/internal/auth"
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
"novamd/internal/secrets"
|
"lemma/internal/secrets"
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
// initSecretsService initializes the secrets service
|
// initSecretsService initializes the secrets service
|
||||||
@@ -79,7 +79,7 @@ func initAuth(cfg *Config, database db.Database) (auth.JWTManager, auth.SessionM
|
|||||||
func setupAdminUser(database db.Database, storageManager storage.Manager, cfg *Config) error {
|
func setupAdminUser(database db.Database, storageManager storage.Manager, cfg *Config) error {
|
||||||
// Check if admin user exists
|
// Check if admin user exists
|
||||||
adminUser, err := database.GetUserByEmail(cfg.AdminEmail)
|
adminUser, err := database.GetUserByEmail(cfg.AdminEmail)
|
||||||
if err != nil && err != sql.ErrNoRows {
|
if err != nil && !strings.Contains(err.Error(), "user not found") {
|
||||||
return fmt.Errorf("failed to check for existing admin user: %w", err)
|
return fmt.Errorf("failed to check for existing admin user: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"novamd/internal/auth"
|
"lemma/internal/auth"
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options holds all dependencies and configuration for the server
|
// Options holds all dependencies and configuration for the server
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"novamd/internal/auth"
|
"lemma/internal/auth"
|
||||||
"novamd/internal/context"
|
"lemma/internal/context"
|
||||||
"novamd/internal/handlers"
|
"lemma/internal/handlers"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
httpSwagger "github.com/swaggo/http-swagger"
|
httpSwagger "github.com/swaggo/http-swagger"
|
||||||
|
|
||||||
_ "novamd/docs" // Swagger docs
|
_ "lemma/docs" // Swagger docs
|
||||||
)
|
)
|
||||||
|
|
||||||
// setupRouter creates and configures the chi router with middleware and routes
|
// setupRouter creates and configures the chi router with middleware and routes
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"lemma/internal/logging"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/logging"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
package auth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"lemma/internal/logging"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/logging"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var logger logging.Logger
|
var logger logging.Logger
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/auth"
|
"lemma/internal/auth"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewJWTService(t *testing.T) {
|
func TestNewJWTService(t *testing.T) {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package auth
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/subtle"
|
"crypto/subtle"
|
||||||
|
"lemma/internal/context"
|
||||||
|
"lemma/internal/logging"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/context"
|
|
||||||
"novamd/internal/logging"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func getMiddlewareLogger() logging.Logger {
|
func getMiddlewareLogger() logging.Logger {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/auth"
|
"lemma/internal/auth"
|
||||||
"novamd/internal/context"
|
"lemma/internal/context"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mock SessionManager
|
// Mock SessionManager
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package auth
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/auth"
|
"lemma/internal/auth"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mock SessionStore
|
// Mock SessionStore
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ package context
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"lemma/internal/logging"
|
||||||
|
"lemma/internal/models"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/logging"
|
|
||||||
"novamd/internal/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type contextKey string
|
type contextKey string
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/context"
|
"lemma/internal/context"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetRequestContext(t *testing.T) {
|
func TestGetRequestContext(t *testing.T) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package context
|
package context
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"lemma/internal/db"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/db"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/context"
|
"lemma/internal/context"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockDB implements the minimal database interface needed for testing
|
// MockDB implements the minimal database interface needed for testing
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
"novamd/internal/secrets"
|
"lemma/internal/secrets"
|
||||||
|
|
||||||
_ "github.com/mattn/go-sqlite3" // SQLite driver
|
_ "github.com/mattn/go-sqlite3" // SQLite driver
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package db_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
|
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateSession inserts a new session record into the database
|
// CreateSession inserts a new session record into the database
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package db
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateUser inserts a new user record into the database
|
// CreateUser inserts a new user record into the database
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUserOperations(t *testing.T) {
|
func TestUserOperations(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package db
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateWorkspace inserts a new workspace record into the database
|
// CreateWorkspace inserts a new workspace record into the database
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWorkspaceOperations(t *testing.T) {
|
func TestWorkspaceOperations(t *testing.T) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
|
|
||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
"github.com/go-git/go-git/v5/plumbing"
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"lemma/internal/context"
|
||||||
|
"lemma/internal/db"
|
||||||
|
"lemma/internal/logging"
|
||||||
|
"lemma/internal/models"
|
||||||
|
"lemma/internal/storage"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/context"
|
|
||||||
"novamd/internal/db"
|
|
||||||
"novamd/internal/logging"
|
|
||||||
"novamd/internal/models"
|
|
||||||
"novamd/internal/storage"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/handlers"
|
"lemma/internal/handlers"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"lemma/internal/auth"
|
||||||
|
"lemma/internal/context"
|
||||||
|
"lemma/internal/logging"
|
||||||
|
"lemma/internal/models"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/auth"
|
|
||||||
"novamd/internal/context"
|
|
||||||
"novamd/internal/logging"
|
|
||||||
"novamd/internal/models"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/handlers"
|
"lemma/internal/handlers"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"novamd/internal/context"
|
"lemma/internal/context"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"lemma/internal/context"
|
||||||
|
"lemma/internal/logging"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/context"
|
|
||||||
"novamd/internal/logging"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CommitRequest represents a request to commit changes
|
// CommitRequest represents a request to commit changes
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"lemma/internal/db"
|
||||||
|
"lemma/internal/logging"
|
||||||
|
"lemma/internal/storage"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/db"
|
|
||||||
"novamd/internal/logging"
|
|
||||||
"novamd/internal/storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrorResponse is a generic error response
|
// ErrorResponse is a generic error response
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"novamd/internal/app"
|
"lemma/internal/app"
|
||||||
"novamd/internal/auth"
|
"lemma/internal/auth"
|
||||||
"novamd/internal/db"
|
"lemma/internal/db"
|
||||||
"novamd/internal/git"
|
"lemma/internal/git"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
"novamd/internal/secrets"
|
"lemma/internal/secrets"
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
|
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// testHarness encapsulates all the dependencies needed for testing
|
// testHarness encapsulates all the dependencies needed for testing
|
||||||
@@ -50,7 +50,7 @@ func setupTestHarness(t *testing.T) *testHarness {
|
|||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
// Create temporary directory for test files
|
// Create temporary directory for test files
|
||||||
tempDir, err := os.MkdirTemp("", "novamd-test-*")
|
tempDir, err := os.MkdirTemp("", "lemma-test-*")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create temp directory: %v", err)
|
t.Fatalf("Failed to create temp directory: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"lemma/internal/logging"
|
||||||
"net/http"
|
"net/http"
|
||||||
"novamd/internal/logging"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/handlers"
|
"lemma/internal/handlers"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
func TestStaticHandler_Integration(t *testing.T) {
|
func TestStaticHandler_Integration(t *testing.T) {
|
||||||
// Create temporary directory for test static files
|
// Create temporary directory for test static files
|
||||||
tempDir, err := os.MkdirTemp("", "novamd-static-test-*")
|
tempDir, err := os.MkdirTemp("", "lemmastatic-test-*")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer os.RemoveAll(tempDir)
|
defer os.RemoveAll(tempDir)
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"novamd/internal/context"
|
"lemma/internal/context"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/handlers"
|
"lemma/internal/handlers"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"novamd/internal/context"
|
"lemma/internal/context"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeleteWorkspaceResponse contains the name of the next workspace after deleting the current one
|
// DeleteWorkspaceResponse contains the name of the next workspace after deleting the current one
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/models"
|
"lemma/internal/models"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Service is an interface for encrypting and decrypting strings
|
// Service is an interface for encrypting and decrypting strings
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/secrets"
|
"lemma/internal/secrets"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestValidateKey(t *testing.T) {
|
func TestValidateKey(t *testing.T) {
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package storage_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestFileNode ensures FileNode structs are created correctly
|
// TestFileNode ensures FileNode structs are created correctly
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"novamd/internal/logging"
|
"lemma/internal/logging"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockDirEntry struct {
|
type mockDirEntry struct {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"novamd/internal/git"
|
"lemma/internal/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RepositoryManager defines the interface for managing Git repositories.
|
// RepositoryManager defines the interface for managing Git repositories.
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/git"
|
"lemma/internal/git"
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockGitClient implements git.Client interface for testing
|
// MockGitClient implements git.Client interface for testing
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"novamd/internal/git"
|
"lemma/internal/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Manager interface combines all storage interfaces.
|
// Manager interface combines all storage interfaces.
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"novamd/internal/storage"
|
"lemma/internal/storage"
|
||||||
_ "novamd/internal/testenv"
|
_ "lemma/internal/testenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestValidatePath(t *testing.T) {
|
func TestValidatePath(t *testing.T) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Package testenv provides a setup for testing the application.
|
// Package testenv provides a setup for testing the application.
|
||||||
package testenv
|
package testenv
|
||||||
|
|
||||||
import "novamd/internal/logging"
|
import "lemma/internal/logging"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Initialize the logger
|
// Initialize the logger
|
||||||
|
|||||||
Reference in New Issue
Block a user