mirror of
https://github.com/pikami/cosmium.git
synced 2025-06-07 16:10:23 +01:00
Compare commits
No commits in common. "ec5f82cd543ca3083ad6d65b3d0fdf8d3e2fae5a" and "398584368f7e3a938e09238a6f15fa61df336337" have entirely different histories.
ec5f82cd54
...
398584368f
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@ -7,7 +7,6 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
packages: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
@ -21,12 +20,6 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.6
|
go-version: 1.21.6
|
||||||
- name: Docker Login
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
|
@ -31,22 +31,5 @@ brews:
|
|||||||
name: pikami
|
name: pikami
|
||||||
email: git@pikami.org
|
email: git@pikami.org
|
||||||
|
|
||||||
dockers:
|
|
||||||
- image_templates:
|
|
||||||
- "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}"
|
|
||||||
- "ghcr.io/pikami/{{ .ProjectName }}:latest"
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
use: docker
|
|
||||||
build_flag_templates:
|
|
||||||
- "--platform=linux/amd64"
|
|
||||||
- "--pull"
|
|
||||||
- "--label=org.opencontainers.image.title={{.ProjectName}}"
|
|
||||||
- "--label=org.opencontainers.image.description=Lightweight Cosmos DB emulator"
|
|
||||||
- "--label=org.opencontainers.image.url=https://github.com/pikami/cosmium"
|
|
||||||
- "--label=org.opencontainers.image.source=https://github.com/pikami/cosmium"
|
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
|
||||||
|
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
FROM scratch
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY cosmium /app/cosmium
|
|
||||||
|
|
||||||
ENTRYPOINT ["/app/cosmium"]
|
|
20
README.md
20
README.md
@ -47,17 +47,6 @@ If you want to run Cosmos DB Explorer alongside Cosmium, you'll need to build it
|
|||||||
|
|
||||||
Once running, the explorer can be reached by navigating following URL: `https://127.0.0.1:8081/_explorer/` (might be different depending on your configuration).
|
Once running, the explorer can be reached by navigating following URL: `https://127.0.0.1:8081/_explorer/` (might be different depending on your configuration).
|
||||||
|
|
||||||
### Running with docker (optional)
|
|
||||||
|
|
||||||
If you wan to run the application using docker, configure it using environment variables see example:
|
|
||||||
```sh
|
|
||||||
docker run --rm \
|
|
||||||
-e Persist=/save.json \
|
|
||||||
-v ./save.json:/save.json \
|
|
||||||
-p 8081:8081 \
|
|
||||||
ghcr.io/pikami/cosmium
|
|
||||||
```
|
|
||||||
|
|
||||||
### SSL Certificate
|
### SSL Certificate
|
||||||
|
|
||||||
By default, Cosmium uses a pre-generated SSL certificate. You can provide your own certificates by specifying paths to the SSL certificate and key (PEM format) using the `-Cert` and `-CertKey` arguments, respectively.
|
By default, Cosmium uses a pre-generated SSL certificate. You can provide your own certificates by specifying paths to the SSL certificate and key (PEM format) using the `-Cert` and `-CertKey` arguments, respectively.
|
||||||
@ -76,14 +65,5 @@ To disable SSL and run Cosmium on HTTP instead, you can use the `-DisableTls` fl
|
|||||||
|
|
||||||
These arguments allow you to configure various aspects of Cosmium's behavior according to your requirements.
|
These arguments allow you to configure various aspects of Cosmium's behavior according to your requirements.
|
||||||
|
|
||||||
All mentioned arguments can also be set using environment variables:
|
|
||||||
* **COSMIUM_ACCOUNTKEY** for `-AccountKey`
|
|
||||||
* **COSMIUM_DISABLEAUTH** for `-DisableAuth`
|
|
||||||
* **COSMIUM_HOST** for `-Host`
|
|
||||||
* **COSMIUM_INITIALDATA** for `-InitialData`
|
|
||||||
* **COSMIUM_PERSIST** for `-Persist`
|
|
||||||
* **COSMIUM_PORT** for `-Port`
|
|
||||||
* **COSMIUM_DEBUG** for `-Debug`
|
|
||||||
|
|
||||||
# License
|
# License
|
||||||
This project is [MIT licensed](./LICENSE).
|
This project is [MIT licensed](./LICENSE).
|
||||||
|
@ -3,13 +3,10 @@ package config
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultAccountKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
|
DefaultAccountKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
|
||||||
EnvPrefix = "COSMIUM_"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Config = ServerConfig{}
|
var Config = ServerConfig{}
|
||||||
@ -28,7 +25,6 @@ func ParseFlags() {
|
|||||||
debug := flag.Bool("Debug", false, "Runs application in debug mode, this provides additional logging")
|
debug := flag.Bool("Debug", false, "Runs application in debug mode, this provides additional logging")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
setFlagsFromEnvironment()
|
|
||||||
|
|
||||||
Config.Host = *host
|
Config.Host = *host
|
||||||
Config.Port = *port
|
Config.Port = *port
|
||||||
@ -46,17 +42,3 @@ func ParseFlags() {
|
|||||||
Config.DatabaseEndpoint = fmt.Sprintf("https://%s:%d/", Config.Host, Config.Port)
|
Config.DatabaseEndpoint = fmt.Sprintf("https://%s:%d/", Config.Host, Config.Port)
|
||||||
Config.AccountKey = *accountKey
|
Config.AccountKey = *accountKey
|
||||||
}
|
}
|
||||||
|
|
||||||
func setFlagsFromEnvironment() (err error) {
|
|
||||||
flag.VisitAll(func(f *flag.Flag) {
|
|
||||||
name := EnvPrefix + strings.ToUpper(strings.Replace(f.Name, "-", "_", -1))
|
|
||||||
if value, ok := os.LookupEnv(name); ok {
|
|
||||||
err2 := flag.Set(f.Name, value)
|
|
||||||
if err2 != nil {
|
|
||||||
err = fmt.Errorf("failed setting flag from environment: %w", err2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user