20 Commits

Author SHA1 Message Date
7df43f2cf3
🐛 fixes a bug not using the JWT Key correctly 2024-01-21 16:06:36 +01:00
f4b6197728
🏗️ Move calling Generate function to rules
This change moves the responsibility of calling the HostnameRule.Generate
function to the corresponding HostnameRule.{Insert,Update} functions
which will allow autonomy especially for the update functions on when
a hostname needs to be regenerated.
2024-01-21 16:00:33 +01:00
df6a785ac4
📄 add license 2024-01-21 14:59:42 +01:00
a871f165b7
🎨 Use os.readfile instead of ioutil 2024-01-21 14:58:27 +01:00
c51a17993e
🎨 Refactor basic server structure
These changes refactor the router handling into its own package to keep
main.go clean. Also API handlers are here refactored to their corresponding
files.
2024-01-21 14:54:34 +01:00
a4748d7619
♻️ Rework rules registration
This commit adds a rule registry as a central place to register new
rules. It will expose a Description and a factory to create a rule
object.
2024-01-21 14:45:58 +01:00
8d2f411073
📄 Add a License
This commit adds a LICENSE file to the repository root and begins the
process of migrating from the preliminary MIT license we chose to the
Apache License 2.0
2024-01-18 01:22:43 +01:00
83753c3ee1
🔧 Create a configuration file interface
This commit adds the ability to provide a config file in different ways:

The following options are given in the order in which they are checked:
1. A config file path passed by the -c parameter on the command line
2. A config file path passed by the HS_CONFIGFILE environment variable
3. A config.json file in the application root

Should these fail we try to get the parameters for the config struct
directly from environment variables or secret files as used in a
container environment. As example the JwtKey can be supplied by either
passing the value through:

* An environment variable HS_CONFIG_JWTKEY which contains the value directly
* An environment variable HS_CONFIG_JWTKEY_FILE which contains a path
  pointing to the Secret File
2024-01-18 01:04:43 +01:00
c08de78984
📝 Update generated documentation with new Models
This commit contains the new documentation for the API endpoints that
will now use the newly generated models that describe their reponse
correctly
2024-01-18 00:15:14 +01:00
f0118ab8ea
🐛 Use OldHostname when querying the Database
In BaseRule.baseUpdate our goal is to check if a hostname exists before
trying to rename that hostname into something else. This patch fixes an
error where the newly generated Hostname was used to check for the
existence of the old hostname.
2024-01-18 00:11:39 +01:00
ce4d469466
🚧 Begin implementing the Models 2024-01-18 00:10:48 +01:00
607682884c
📝 Create missing models for API documentation 2024-01-18 00:09:26 +01:00
e0190f4bb5
⬆️ Upgrade dependencies
This commits upgrades the following go dependencies:
- github.com/bytedance/sonic v1.9.2
- github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d
- github.com/chenzhuoyu/iasm v0.9.1
2024-01-17 22:43:53 +01:00
80d565e978
🎨 prepare to make the database name configurable
We should not hardcode the database name at different places in
db.Init(). This will allow to make the database path configurable
in a later change, and importantly prevent discrepancies
2024-01-17 22:24:18 +01:00
49281f2ca8
✏️ fix outdated function name in comment 2024-01-17 22:20:29 +01:00
6ee74a3979
build(deps): update dependencies, see below
* bump go.uber.org/atomic version to "v1.11.0"
* bump github.com/bytedance/sonic version to "v1.9.2"
* bump github.com/gabriel-vasile/mimetype version to "v1.4.3"
* bump github.com/go-playground/validator/v10 version to "v10.17.0"
* bump github.com/klauspost/cpuid/v2 version to "v2.2.6"
* bump github.com/mattn/go-isatty version to "v0.0.20"
* bump github.com/pelletier/go-toml/v2 version to "v2.1.1"
* bump github.com/ugorji/go/codec version to "v1.2.12"
* bump golang.org/x/arch version to "v0.7.0"
* bump golang.org/x/crypto version to "v0.18.0"
* bump google.golang.org/protobuf version to "v1.32.0"
2024-01-17 22:14:11 +01:00
df673d1b7f
Merge branch 'main' of git.beisel.it:florian/hostname-service into main 2024-01-17 22:13:35 +01:00
691eacf5da
chore: add gitignore
This commits adds a .gitignore file which will prevent committing of:
* Files referenced in Go.gitignore
* VisualStudioCode specific files (.vscode, ...)
* Windows specific files (ie thumbs.db)
* SQLite Databases
2024-01-17 22:09:43 +01:00
c073152a13
hostname-service.db gelöscht 2024-01-17 18:35:48 +01:00
b58430af9a
Initial commit 2024-01-17 18:05:55 +01:00