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