mirror of
https://github.com/Luzifer/ots.git
synced 2024-12-18 12:04:35 -05:00
Add Tiltfile for local development
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
51313d02aa
commit
8cc6f23b04
11
README.md
11
README.md
@ -90,6 +90,17 @@ You will now need to supply the web application with the password in addition to
|
||||
|
||||
In this case due to how browsers are handling hashes in URLs (the part after the `#`) the only URL the server gets to know is `https://ots.fyi/` which loads the frontend. Afterwards the Javascript executed in the browser fetches the encrypted secret at the given ID and decrypts it with the given password (in this case `mypass`). I will not be able to tell the content of your secret and just see the AES 256bit encrypted content.
|
||||
|
||||
## Local development
|
||||
|
||||
This repo contains a `Tilefile` to be used with [tilt v0.33+](https://tilt.dev/) to build and start the server for development.
|
||||
|
||||
Requirements:
|
||||
- Go v1.23+
|
||||
- Node v22+
|
||||
- Tilt v0.33+
|
||||
|
||||
Just run `tilt up` and visit `http://localhost:15641/` for the development server.
|
||||
|
||||
## Localize to your own language
|
||||
|
||||
If you want to help translating the application to your own language please see the [`i18n.yaml`](https://github.com/Luzifer/ots/blob/master/i18n.yaml) file from this repository and translate the English strings inside. Afterwards please [open an issue](https://github.com/Luzifer/ots/issues/new) and attach your translation including the information which language you translated the strings into.
|
||||
|
46
Tiltfile
Normal file
46
Tiltfile
Normal file
@ -0,0 +1,46 @@
|
||||
# Install Node deps on change of package.json
|
||||
local_resource(
|
||||
'npm',
|
||||
cmd='npm i',
|
||||
deps=['package.json'],
|
||||
)
|
||||
|
||||
# Rebuild frontend if source files change
|
||||
local_resource(
|
||||
'frontend',
|
||||
cmd='node ./ci/build.mjs',
|
||||
deps=['src'],
|
||||
resource_deps=['npm'],
|
||||
)
|
||||
|
||||
# Generate translation files on source change
|
||||
local_resource(
|
||||
'translations',
|
||||
cmd='make translate',
|
||||
deps=['i18n.yaml'],
|
||||
)
|
||||
|
||||
# Rebuild and run Go webserver on code changes
|
||||
local_resource(
|
||||
'server',
|
||||
cmd='go build .',
|
||||
deps=[
|
||||
'api.go',
|
||||
'frontend',
|
||||
'helpers.go',
|
||||
'main.go',
|
||||
'pkg',
|
||||
'storage.go',
|
||||
'tplFuncs.go',
|
||||
],
|
||||
ignore=['ots', 'src'],
|
||||
serve_cmd='./ots --listen=:15641',
|
||||
serve_env={
|
||||
'CUSTOMIZE': 'customize.yaml',
|
||||
},
|
||||
readiness_probe=probe(
|
||||
http_get=http_get_action(15641, path='/api/healthz'),
|
||||
initial_delay_secs=1,
|
||||
),
|
||||
resource_deps=['frontend', 'translations'],
|
||||
)
|
1
api.go
1
api.go
@ -52,6 +52,7 @@ func (a apiServer) Register(r *mux.Router) {
|
||||
r.HandleFunc("/get/{id}", a.handleRead)
|
||||
r.HandleFunc("/isWritable", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNoContent) })
|
||||
r.HandleFunc("/settings", a.handleSettings).Methods(http.MethodGet)
|
||||
r.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) })
|
||||
}
|
||||
|
||||
func (a apiServer) handleCreate(res http.ResponseWriter, r *http.Request) {
|
||||
|
Loading…
Reference in New Issue
Block a user