Merge branch 'main' of gitea.scu.si:Florian.Walther/Web-Password
All checks were successful
/ push_to_registry (push) Successful in 58s

This commit is contained in:
Florian Walther
2026-02-04 00:00:04 +01:00
5 changed files with 70 additions and 14 deletions

View File

@@ -14,8 +14,8 @@ jobs:
- name: Login to Gitea
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }} # gitea.scu.si
username: ${{ gitea.actor }}
registry: ${{ vars.REGISTRY_URL }} # gitea.scu.si
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
@@ -26,5 +26,5 @@ jobs:
# Hier wird die Git-Referenz automatisch als Docker-Tag genutzt
#tags: gitea.scu.si/florianwalther/password-generator:${{ gitea.ref_name }}
tags: |
gitea.scu.si/florianwalther/password-generator:${{ gitea.ref_name }}
gitea.scu.si/florianwalther/password-generator:latest
gitea.scu.si/florian.walther/password-generator:${{ gitea.ref_name }}
gitea.scu.si/florian.walther/password-generator:latest

View File

@@ -1,6 +1,6 @@
# Web-Password
_a web based password generator_
_a web based password generator, with an API endpoint_
![App Screenshot](img/screenshot.png)
@@ -16,7 +16,7 @@ There is a demo at [https://passwd.scu.si](https://passwd.scu.si)
## Usage
The follwoing example shows how to get up your own instance with `docker compose`.
The following example shows how to get up your own instance with `docker compose`.
```
git clone https://gitea.scu.si/FlorianWalther/Web-Password.git
@@ -26,4 +26,15 @@ docker compose pull
docker compose up -d
```
## Docker image
The latest official docker image is at [https://gitea.scu.si/FlorianWalther/-/packages/container/password-generator/latest](https://gitea.scu.si/FlorianWalther/-/packages/container/password-generator/latest)
You can pull it like this:
```
docker pull gitea.scu.si/florian.walther/password-generator:latest
```
## more usage examples
There are some more usage example in [misc/MoreUsage.md](misc/MoreUsage.md)

View File

@@ -42,11 +42,14 @@ func generatePassword() string {
}
func passwordHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("APIHandler called from %s\n", r.RemoteAddr)
password := generatePassword()
fmt.Fprint(w, password)
}
// new help handler
func helpHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("helpHandler called from %s\n", r.RemoteAddr)
helpHTML := `
<!DOCTYPE html>
<html>
@@ -297,7 +300,9 @@ func helpHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, helpHTML)
}
func webHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("webHandler called from %s\n", r.RemoteAddr)
password := generatePassword()
html := fmt.Sprintf(
`<DOCTYPE html>

View File

@@ -1,31 +1,66 @@
## bash alias
You can configure an bash alias in your `~/.bashrc` like this:
# Baue die Go-Anwendung
```
## genpasswd alias
alias genpasswd='echo $(curl -s https://passwd.scu.si/api/password)'
```
After making above changes you have to reload your ~/bashrc, in order to activate your changes.
```
. ~/.bashrc
```
Now you can enter `genpasswd` and get a fresh password from the API Endpoint.
## get 10 fresh passwords
```bash
for i in {1..10}; do echo $(curl -s https://passwd.scu.si/api/password); done
```
# building the app
you can build the app yourself like this:
```
go build -o password-generator ./
```
# Baue das Docker-Image
# build a docker container
```
docker build -t password-generator .
```
# Starte den Docker Container
# start the docker container
```
docker run -p 8080:8080 password-generator
```
## mit docker-compose
## docker-compose
Ein `docker-compose.yml` wird mitgeliefert.
There are two example docker-compose files in the [misc](./) directory.
### docker-compose.yml
A basic variant that just brings up the container and export port 8080.
The basic variant can be used without modifications.
### docker-compose.traefik.yml
The other one is meant to be used behind a traefik reverse proxy.
This variant has lables to configure traefik accordingly.
The traefik variant needs to be adjusted to your environment before
you can use it successfully.
### initial pull
```
docker compose login gitea.scu.si
docker compose pull
```
@@ -41,5 +76,12 @@ docker compose up -d
docker compose down
```
### update container
In order to update your container to the current version, do this:
```
docker compose pull
docker compose up -d
```

View File

@@ -5,8 +5,6 @@ services:
restart: always
expose:
- "8080:8080"
# Falls die Registry privat ist, muss der Host zuvor mit
# 'docker login gitea.scu.si' angemeldet worden sein.
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik_backend"