Skip to content

Commit

Permalink
🔥 wip: add namespace support
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
zcubbs committed Oct 24, 2023
1 parent 8adfdf8 commit 712b7c7
Show file tree
Hide file tree
Showing 61 changed files with 132 additions and 144 deletions.
4 changes: 2 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

project_name: tlz
project_name: ssl-tracker
before:
hooks:
- go mod tidy
Expand Down Expand Up @@ -92,7 +92,7 @@ signs:
release:
github:
owner: zcubbs
name: tlz
name: ssl-tracker
draft: false
prerelease: auto
header: |
Expand Down
4 changes: 2 additions & 2 deletions .taskfiles/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ tasks:
mock:
desc: Generate mocks
cmds:
- cmd: mockgen -package mockdb -destination cmd/server/db/mock/store.go github.com/zcubbs/tlz/cmd/server/db/sqlc Store
- cmd: mockgen -package mockdb -destination cmd/server/worker/mock/distributor.go github.com/zcubbs/tlz/cmd/server/worker TaskDistributor
- cmd: mockgen -package mockdb -destination cmd/server/db/mock/store.go github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc Store
- cmd: mockgen -package mockdb -destination cmd/server/worker/mock/distributor.go github.com/zcubbs/ssl-tracker/cmd/server/worker TaskDistributor

sqlc:
desc: Generate SQLC code
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# TLZ;
# SSL Tracker

[![tag](https://img.shields.io/github/tag/zcubbs/tlz)](https://github.com/zcubbs/tlz/releases)
[![tag](https://img.shields.io/github/tag/zcubbs/tlz)](https://github.com/zcubbs/ssl-tracker/releases)
![Go Version](https://img.shields.io/badge/Go-%3E%3D%201.21-%23007d9c)
[![Lint](https://github.com/zcubbs/tlz/actions/workflows/lint.yaml/badge.svg)](https://github.com/zcubbs/tlz/actions/workflows/lint.yaml)
[![Test](https://github.com/zcubbs/tlz/actions/workflows/test.yaml/badge.svg)](https://github.com/zcubbs/tlz/actions/workflows/test.yaml)
[![release](https://github.com/zcubbs/tlz/actions/workflows/release.yaml/badge.svg)](https://github.com/zcubbs/tlz/actions/workflows/release.yaml)
[![scan](https://github.com/zcubbs/tlz/actions/workflows/scan.yaml/badge.svg)](https://github.com/zcubbs/tlz/actions/workflows/scan.yaml)
[![Contributors](https://img.shields.io/github/contributors/zcubbs/go-containers)](https://github.com/zcubbs/tlz/graphs/contributors)
[![Lint](https://github.com/zcubbs/ssl-tracker/actions/workflows/lint.yaml/badge.svg)](https://github.com/zcubbs/ssl-tracker/actions/workflows/lint.yaml)
[![Test](https://github.com/zcubbs/ssl-tracker/actions/workflows/test.yaml/badge.svg)](https://github.com/zcubbs/ssl-tracker/actions/workflows/test.yaml)
[![release](https://github.com/zcubbs/ssl-tracker/actions/workflows/release.yaml/badge.svg)](https://github.com/zcubbs/ssl-tracker/actions/workflows/release.yaml)
[![scan](https://github.com/zcubbs/ssl-tracker/actions/workflows/scan.yaml/badge.svg)](https://github.com/zcubbs/ssl-tracker/actions/workflows/scan.yaml)
[![Contributors](https://img.shields.io/github/contributors/zcubbs/go-containers)](https://github.com/zcubbs/ssl-tracker/graphs/contributors)

This application is designed to monitor the status and health of SSL/TLS certificates. In today's digital world, ensuring the validity and security of your SSL/TLS certificates is crucial. With our application, you can streamline this process, keeping an eye on your certificates and their expiry dates.

**TLZ;** does more than just monitor - it actively notifies you of any pending expiry dates, ensuring you have ample time to renew and prevent any potential downtime or security issues. By proactively managing your SSL/TLS certificates, our application helps maintain the integrity and reliability of your digital infrastructure.
**SSL Tracker** does more than just monitor - it actively notifies you of any pending expiry dates, ensuring you have ample time to renew and prevent any potential downtime or security issues. By proactively managing your SSL/TLS certificates, our application helps maintain the integrity and reliability of your digital infrastructure.

Whether you are managing a single website or a vast network, this application is designed to be your reliable companion in maintaining your SSL/TLS certificate health.

Expand All @@ -36,7 +36,7 @@ represents a set of times, normally as a schedule to execute some routine. The f
```

> You can choose to run a job only once by passing "-" as the cron pattern.
> Exemple: `TLZ_CRON_CHECK_CERTIFICATE_VALIDITY_CRON_PATTERN=-`
> Exemple: `CRON_CHECK_CERTIFICATE_VALIDITY_CRON_PATTERN=-`
## Database Support

Expand Down Expand Up @@ -82,7 +82,7 @@ SQLite is a self-contained, serverless, zero-configuration SQL database engine,
| `NOTIFICATION_MAIL_SMTP_PORT` | SMTP port for mail notification | `1025` |
| `NOTIFICATION_MAIL_SMTP_USERNAME` | SMTP username for mail notification | `""` |
| `NOTIFICATION_MAIL_SMTP_PASSWORD` | SMTP password for mail notification | `""` |
| `NOTIFICATION_MAIL_SMTP_FROM` | SMTP from address for mail notification | `"no-reply@tlz"` |
| `NOTIFICATION_MAIL_SMTP_FROM` | SMTP from address for mail notification | `"no-reply@ssl-tracker"` |

### YAML Configuration Documentation

Expand Down Expand Up @@ -113,7 +113,7 @@ SQLite is a self-contained, serverless, zero-configuration SQL database engine,
| `notification.mail.smtp.port` | SMTP port for mail notification | `1025` |
| `notification.mail.smtp.username` | SMTP username for mail notification | `""` |
| `notification.mail.smtp.password` | SMTP password for mail notification | `""` |
| `notification.mail.smtp.from` | SMTP from address for mail notification | `"no-reply@tlz"` |
| `notification.mail.smtp.from` | SMTP from address for mail notification | `"no-reply@ssl-tracker"` |

## Development

Expand Down
18 changes: 9 additions & 9 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ vars:
# sqlite connection string
TEST_DB_URL: "file:./db.sqlite?cache=shared&mode=rwc"
LOCAL_HOST: 127.0.0.1
GO_PACKAGE: github.com/zcubbs/tlz
GO_PACKAGE_SHORT: tlz
GO_PACKAGE: github.com/zcubbs/ssl-tracker
GO_PACKAGE_SHORT: ssl-tracker

tasks:
build:
Expand Down Expand Up @@ -209,41 +209,41 @@ tasks:
pg:
desc: Start Postgres
cmds:
- docker run --rm --name tlz-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=tlz -p 5432:5432 -d postgres:14-alpine
- docker run --rm --name ssl-tracker-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=ssl-tracker -p 5432:5432 -d postgres:14-alpine

pg:stop:
desc: Stop Postgres
cmds:
- docker stop tlz-postgres
- docker stop ssl-tracker-postgres

redis:
desc: Start Redis
cmds:
- docker run --rm --name tlz-redis -p 6379:6379 -d redis:alpine
- docker run --rm --name ssl-tracker-redis -p 6379:6379 -d redis:alpine

redis:down:
desc: Stop Redis
cmds:
- docker stop tlz-redis
- docker stop ssl-tracker-redis

mailpit:
desc: Start Mailpit
cmds:
- >-
docker run --rm -d --name tlz-mailpit
docker run --rm -d --name ssl-tracker-mailpit
-p 1025:1025 -p 1080:1080
-e MP_SMTP_AUTH_ACCEPT_ANY=true -e MP_SMTP_AUTH_ALLOW_INSECURE=true
axllent/mailpit
mailpit:down:
desc: Stop Mailpit
cmds:
- docker stop tlz-mailpit
- docker stop ssl-tracker-mailpit

test-grpc:
desc: Run grpcurl tests
cmds:
- grpcurl -plaintext localhost:9000 pb.TlzService/Ping
- grpcurl -plaintext localhost:9000 pb.SslTrackerService/Ping

tls:
desc: Copy TLS certificates
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/api/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package api
import (
"context"
"fmt"
pb "github.com/zcubbs/tlz/pb"
"github.com/zcubbs/tlz/pkg/token"
pb "github.com/zcubbs/ssl-tracker/pb"
"github.com/zcubbs/ssl-tracker/pkg/token"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/api/authorization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"context"
"github.com/google/uuid"
mockdb "github.com/zcubbs/tlz/cmd/server/db/mock"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
mockwk "github.com/zcubbs/tlz/cmd/server/worker/mock"
mockdb "github.com/zcubbs/ssl-tracker/cmd/server/db/mock"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
mockwk "github.com/zcubbs/ssl-tracker/cmd/server/worker/mock"
"github.com/zcubbs/x/random"
"go.uber.org/mock/gomock"
"google.golang.org/grpc/metadata"
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/api/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package api

import (
"github.com/google/uuid"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
pb "github.com/zcubbs/tlz/pb"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
pb "github.com/zcubbs/ssl-tracker/pb"
"google.golang.org/protobuf/types/known/timestamppb"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/server/api/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"time"

"github.com/stretchr/testify/assert"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
pb "github.com/zcubbs/tlz/pb"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
pb "github.com/zcubbs/ssl-tracker/pb"
)

func TestConvertUserToPb(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/api/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package api

import (
"github.com/stretchr/testify/require"
"github.com/zcubbs/tlz/cmd/server/config"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
"github.com/zcubbs/tlz/cmd/server/worker"
"github.com/zcubbs/ssl-tracker/cmd/server/config"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
"github.com/zcubbs/ssl-tracker/cmd/server/worker"
"github.com/zcubbs/x/random"
"testing"
"time"
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/api/rpc_create_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
pb "github.com/zcubbs/tlz/pb"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
pb "github.com/zcubbs/ssl-tracker/pb"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/api/rpc_create_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package api
import (
"context"
"github.com/google/uuid"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
pb "github.com/zcubbs/tlz/pb"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
pb "github.com/zcubbs/ssl-tracker/pb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/api/rpc_create_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package api

import (
"context"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
dbUtil "github.com/zcubbs/tlz/cmd/server/db/util"
pb "github.com/zcubbs/tlz/pb"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
dbUtil "github.com/zcubbs/ssl-tracker/cmd/server/db/util"
pb "github.com/zcubbs/ssl-tracker/pb"
"github.com/zcubbs/x/password"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/api/rpc_get_domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package api

import (
"context"
pb "github.com/zcubbs/tlz/pb"
pb "github.com/zcubbs/ssl-tracker/pb"
)

func (s *Server) GetDomains(ctx context.Context, req *pb.Empty) (*pb.GetDomainsResponse, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/api/rpc_get_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package api

import (
"context"
pb "github.com/zcubbs/tlz/pb"
pb "github.com/zcubbs/ssl-tracker/pb"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/api/rpc_login_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"context"
"errors"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
dbUtil "github.com/zcubbs/tlz/cmd/server/db/util"
pb "github.com/zcubbs/tlz/pb"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
dbUtil "github.com/zcubbs/ssl-tracker/cmd/server/db/util"
pb "github.com/zcubbs/ssl-tracker/pb"
"github.com/zcubbs/x/password"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/api/rpc_logout_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package api
import (
"context"
"github.com/google/uuid"
pb "github.com/zcubbs/tlz/pb"
pb "github.com/zcubbs/ssl-tracker/pb"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/api/rpc_ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package api

import (
"context"
"github.com/zcubbs/tlz/cmd/server/config"
pb "github.com/zcubbs/tlz/pb"
"github.com/zcubbs/ssl-tracker/cmd/server/config"
pb "github.com/zcubbs/ssl-tracker/pb"
)

func (s *Server) Ping(_ context.Context, _ *pb.Empty) (*pb.PingResponse, error) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/api/rpc_ping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"context"
"github.com/stretchr/testify/require"
mockdb "github.com/zcubbs/tlz/cmd/server/db/mock"
mockwk "github.com/zcubbs/tlz/cmd/server/worker/mock"
pb "github.com/zcubbs/tlz/pb"
mockdb "github.com/zcubbs/ssl-tracker/cmd/server/db/mock"
mockwk "github.com/zcubbs/ssl-tracker/cmd/server/worker/mock"
pb "github.com/zcubbs/ssl-tracker/pb"
"go.uber.org/mock/gomock"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/api/rpc_refresh_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package api

import (
"context"
pb "github.com/zcubbs/tlz/pb"
pb "github.com/zcubbs/ssl-tracker/pb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/api/rpc_verify_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package api
import (
"context"
"github.com/google/uuid"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
"github.com/zcubbs/tlz/cmd/server/validator"
pb "github.com/zcubbs/tlz/pb"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
"github.com/zcubbs/ssl-tracker/cmd/server/validator"
pb "github.com/zcubbs/ssl-tracker/pb"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
12 changes: 6 additions & 6 deletions cmd/server/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"fmt"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/rs/cors"
"github.com/zcubbs/tlz/cmd/server/config"
db "github.com/zcubbs/tlz/cmd/server/db/sqlc"
"github.com/zcubbs/tlz/cmd/server/logger"
"github.com/zcubbs/tlz/cmd/server/worker"
pb "github.com/zcubbs/tlz/pb"
"github.com/zcubbs/tlz/pkg/token"
"github.com/zcubbs/ssl-tracker/cmd/server/config"
db "github.com/zcubbs/ssl-tracker/cmd/server/db/sqlc"
"github.com/zcubbs/ssl-tracker/cmd/server/logger"
"github.com/zcubbs/ssl-tracker/cmd/server/worker"
pb "github.com/zcubbs/ssl-tracker/pb"
"github.com/zcubbs/ssl-tracker/pkg/token"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/encoding/protojson"
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/joho/godotenv"
"github.com/spf13/viper"
lwl "github.com/zcubbs/logwrapper/logger"
"github.com/zcubbs/tlz/cmd/server/logger"
"github.com/zcubbs/ssl-tracker/cmd/server/logger"

"os"
"strings"
Expand Down
15 changes: 7 additions & 8 deletions cmd/server/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package config
import "fmt"

const (
ViperConfigName = "config"
ViperConfigType = "yaml"
ViperConfigEnvPrefix = "LU"
DefaultDbName = "tlz"
Localhost = "127.0.0.1"
HttpPort = 8000
GrpcPort = 9000
ViperConfigName = "config"
ViperConfigType = "yaml"
DefaultDbName = "ssl-tracker"
Localhost = "127.0.0.1"
HttpPort = 8000
GrpcPort = 9000
)

var (
Expand Down Expand Up @@ -57,7 +56,7 @@ var (
"notification.mail.smtp.username": "",
"notification.mail.smtp.password": "",
"notification.mail.smtp.from_address": "no-reply@localhost",
"notification.mail.smtp.from_name": "TLZ",
"notification.mail.smtp.from_name": "ssl-tracker",
}

allowedEnvVarKeys = []string{
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/db/connect/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"fmt"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/zcubbs/tlz/cmd/server/config"
"github.com/zcubbs/ssl-tracker/cmd/server/config"
)

func Connect(ctx context.Context, config config.DatabaseConfig) (*pgxpool.Pool, error) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/db/connect/db_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package connect

import (
"fmt"
"github.com/zcubbs/tlz/cmd/server/config"
"github.com/zcubbs/tlz/cmd/server/logger"
"github.com/zcubbs/ssl-tracker/cmd/server/config"
"github.com/zcubbs/ssl-tracker/cmd/server/logger"
)

var (
Expand Down
Loading

0 comments on commit 712b7c7

Please sign in to comment.