Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 33fe4b2b80 | |||
| 21f512c2d7 | |||
| dfda16f8e1 | |||
| 44bb35abac | |||
| 1ae5f9c679 | |||
| 9a052b3ef7 | |||
| 9a906ec55c | |||
| 8b93585422 |
@@ -14,8 +14,8 @@ jobs:
|
|||||||
- name: Login to Gitea
|
- name: Login to Gitea
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.REGISTRY_URL }} # gitea.scu.si
|
registry: ${{ vars.REGISTRY_URL }} # gitea.scu.si
|
||||||
username: ${{ gitea.actor }}
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
@@ -26,5 +26,5 @@ jobs:
|
|||||||
# Hier wird die Git-Referenz automatisch als Docker-Tag genutzt
|
# 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 }}
|
||||||
tags: |
|
tags: |
|
||||||
gitea.scu.si/florianwalther/password-generator:${{ gitea.ref_name }}
|
gitea.scu.si/florian.walther/password-generator:${{ gitea.ref_name }}
|
||||||
gitea.scu.si/florianwalther/password-generator:latest
|
gitea.scu.si/florian.walther/password-generator:latest
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ The latest official docker image is at [https://gitea.scu.si/FlorianWalther/-/pa
|
|||||||
|
|
||||||
You can pull it like this:
|
You can pull it like this:
|
||||||
```
|
```
|
||||||
docker pull gitea.scu.si/florianwalther/password-generator:latest
|
docker pull gitea.scu.si/florian.walther/password-generator:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## more usage examples
|
## more usage examples
|
||||||
|
|||||||
5
main.go
5
main.go
@@ -42,12 +42,14 @@ func generatePassword() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func passwordHandler(w http.ResponseWriter, r *http.Request) {
|
func passwordHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("APIHandler called from %s\n", r.RemoteAddr)
|
||||||
password := generatePassword()
|
password := generatePassword()
|
||||||
fmt.Fprint(w, password)
|
fmt.Fprint(w, password)
|
||||||
}
|
}
|
||||||
|
|
||||||
// new help handler
|
// new help handler
|
||||||
func helpHandler(w http.ResponseWriter, r *http.Request) {
|
func helpHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("helpHandler called from %s\n", r.RemoteAddr)
|
||||||
helpHTML := `
|
helpHTML := `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -119,7 +121,7 @@ func helpHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
<script>
|
<script>
|
||||||
// Dynamisch den aktuellen Hostnamen ermitteln
|
// Dynamisch den aktuellen Hostnamen ermitteln
|
||||||
const currentHost = window.location.host;
|
const currentHost = window.location.host;
|
||||||
const apiEndpoint = "http://" + currentHost + "/api/password";
|
const apiEndpoint = "https://" + currentHost + "/api/password";
|
||||||
|
|
||||||
// Hostnamen in die Beispiele eintragen
|
// Hostnamen in die Beispiele eintragen
|
||||||
document.getElementById("api-endpoint").textContent = apiEndpoint;
|
document.getElementById("api-endpoint").textContent = apiEndpoint;
|
||||||
@@ -136,6 +138,7 @@ func helpHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
|
|
||||||
func webHandler(w http.ResponseWriter, r *http.Request) {
|
func webHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("webHandler called from %s\n", r.RemoteAddr)
|
||||||
password := generatePassword()
|
password := generatePassword()
|
||||||
html := fmt.Sprintf(
|
html := fmt.Sprintf(
|
||||||
`<DOCTYPE html>
|
`<DOCTYPE html>
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ After making above changes you have to reload your ~/bashrc, in order to activat
|
|||||||
|
|
||||||
Now you can enter `genpasswd` and get a fresh password from the API Endpoint.
|
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
|
# building the app
|
||||||
|
|
||||||
you can build the app yourself like this:
|
you can build the app yourself like this:
|
||||||
@@ -75,7 +81,6 @@ docker compose down
|
|||||||
In order to update your container to the current version, do this:
|
In order to update your container to the current version, do this:
|
||||||
```
|
```
|
||||||
docker compose pull
|
docker compose pull
|
||||||
docker compose down
|
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user