Skip to content

Commit

Permalink
Merge pull request #26 from r7wx/development
Browse files Browse the repository at this point in the history
Development to Master
  • Loading branch information
r7wx authored Aug 10, 2022
2 parents e4debb3 + e0b8c96 commit 5ff9885
Show file tree
Hide file tree
Showing 39 changed files with 947 additions and 780 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ web/build/*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
test-config.json
test-config.yml
.vscode/
easy_gate_test_*
.vscode/
example.json
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ COPY . .
COPY --from=web-builder ./easy-gate-web/build ./web/build
RUN make easy-gate

FROM scratch AS easy-gate
FROM alpine:3.16 AS easy-gate
ENV EASY_GATE_CONFIG_PATH="/etc/easy-gate/easy-gate.json"
WORKDIR /etc/easy-gate
COPY ./assets/easy-gate.json .
Expand Down
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

---

<img src="assets/screenshot.png" />
<img src="assets/demo.png" />

<p align="justify">
Easy Gate is a simple web application built in Go and React that acts as the home page for your self-hosted infrastructure. Services and notes are parsed from a configuration file in real-time (without restarting the application). Items can also be assigned to one or more groups to show them only to specific users (based on their IP addresses).
Expand All @@ -27,7 +27,7 @@ Easy Gate is a simple web application built in Go and React that acts as the hom

- Service and note parsing from a configuration file (JSON/YAML) in real-time (without restarting the application).
- Service and note assignment to one or more groups to show items only to specific users (based on their IP addresses).
- Customizable theme.
- Customizable theme and icons.
- Run as dependecy free standalone executable or as a Docker container.

## Deployment
Expand Down Expand Up @@ -193,8 +193,6 @@ Easy gate can be configured by a JSON or a YAML configuration file. An example c
- **key_file:** Path to the SSL key file (if TLS is enabled)
- **behind_proxy:** If true, the application will use the X-Forwarded-For header to determine the IP address of the client
- **title:** Title of the application
- **icon:** Font-awesome icon to use as the application icon
- **motd:** Message to display on home page

### Theme

Expand All @@ -209,7 +207,7 @@ Example of a dark mode theme:
```json
"theme": {
"background": "#1d1d1d",
"foreground": "#ffffff"
"foreground": "#ffffff",
}
```

Expand All @@ -224,7 +222,8 @@ theme:
### Groups
<p align="justify">
Group entries are used to define which users can see which items, by providing the user subnet:
Group entries are used to define which users can see which items, by providing the user subnet. Group functionality is useful when dealing with both internal network and VPN users.
</p>
#### JSON
Expand Down Expand Up @@ -255,39 +254,43 @@ groups:
### Services
<p align="justify">
A service entry is used to define a service that is available in the infrastructure. Each service has a name, an url, an icon and the groups that can see it (defined in the groups section). If no group is provided the item can be seen by all users:
A service entry is used to define a service that is available in the infrastructure. Each service has the following configurable parameters:
- **name:** the name of the service (ex. Internal Git, Jenkins, ...)
- **url:** the service url (must be a valid url starting with http(s)://)
- **groups:** list of groups associated to this service (defined in the groups section). If no group is provided the item can be seen by all users:
- **icon (optional):** the icon parameter accepts image URLs or data URI. If the icon parameter is not provided or empty, Easy Gate will try to fetch the service favicon and display it or fallback to a default icon.
</p>
#### JSON
```json
{
"icon": "fa-brands fa-git-square",
"name": "Git",
"url": "https://git.example.vpn",
"url": "https://git.example.internal",
"groups": [
"vpn"
]
},
{
"icon": "fa-brands fa-docker",
"name": "Portainer",
"url": "https://portainer.example.internal",
"url": "https://portainer.example.all",
"icon": "data:image/png;base64,[...]",
"groups": []
}
```

#### YAML

```yml
- icon: fa-brands fa-git-square
name: Git
url: https://git.example.vpn
- name: Git
url: https://git.example.internal
groups:
- vpn
- icon: fa-brands fa-docker
name: Portainer
url: https://portainer.example.internal
- name: Portainer
url: https://portainer.example.all
icon: data:image/png;base64,[...]
groups: []
```
Expand Down Expand Up @@ -326,10 +329,6 @@ A note entry is used to define a simple text note which has a title and a conten
groups: []
```
### Icons
Icons are provided by the [Font Awesome](https://fontawesome.com/icons?d=gallery) library. Get the appropriate icon name by using the Font Awesome website (only free icons are available).
### Environment Variables
- **EASY_GATE_CONFIG_PATH:** Easy Gate configuration file path can be provided by this environment variable. The value will have precedence over the configuration file path provided in the command line.
Expand Down
Binary file added assets/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions assets/easy-gate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"key_file": "",
"behind_proxy": false,
"title": "Easy Gate",
"icon": "fa-solid fa-cubes",
"motd": "Welcome to Easy Gate",
"theme": {
"background": "#FFFFFF",
"foreground": "#000000"
Expand Down
Binary file removed assets/screenshot.png
Binary file not shown.
14 changes: 9 additions & 5 deletions cmd/easy-gate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ import (
"time"

"github.com/r7wx/easy-gate/internal/config"
"github.com/r7wx/easy-gate/internal/routine"
"github.com/r7wx/easy-gate/internal/service"
)

func main() {
log.SetPrefix("[Easy Gate] ")

cfgFilePath, err := config.GetConfigPath(os.Args)
if err != nil {
log.Fatal("[Easy Gate] No configuration file provided")
log.Fatal("No configuration file provided")
}

log.Println("[Easy Gate] Loading configuration file:",
cfgFilePath)
cfgRoutine := config.NewRoutine(cfgFilePath,
1*time.Second)
log.Println("Loading configuration file:", cfgFilePath)
cfgRoutine, err := routine.NewRoutine(cfgFilePath, 1*time.Second)
if err != nil {
log.Fatal(err)
}
go cfgRoutine.Start()

service := service.NewService(cfgRoutine)
Expand Down
114 changes: 2 additions & 112 deletions easy-gate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"key_file": "",
"behind_proxy": false,
"title": "Easy Gate",
"icon": "fa-solid fa-cubes",
"motd": "Welcome to Easy Gate",
"theme": {
"background": "#FFFFFF",
"foreground": "#000000"
Expand All @@ -23,127 +21,29 @@
],
"services": [
{
"icon": "fa-brands fa-git-square",
"name": "Git",
"url": "https://git.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-brands fa-git-square",
"name": "Git",
"url": "https://git.example.vpn",
"groups": [
"internal",
"vpn"
]
},
{
"icon": "fa-brands fa-docker",
"name": "Portainer",
"url": "https://portainer.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-solid fa-folder-open",
"name": "Files",
"url": "https://files.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-solid fa-box-archive",
"name": "Archive",
"url": "https://archive.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-solid fa-chart-line",
"name": "Kibana",
"url": "https://kibana.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-solid fa-download",
"name": "Transmission",
"url": "https://transmission.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-solid fa-bookmark",
"name": "Bookmarks",
"url": "https://bookmarks.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-solid fa-book",
"name": "Calibre",
"url": "https://calibre.example.internal",
"groups": [
"internal"
]
},
{
"icon": "fa-solid fa-comment",
"name": "Webchat",
"url": "https://chat.example.internal",
"groups": []
},
{
"icon": "fa-solid fa-cloud",
"name": "Owncloud",
"url": "https://owncloud.example.internal",
"groups": [
"internal",
"vpn"
]
},
{
"icon": "fa-brands fa-wikipedia-w",
"name": "Wiki",
"url": "https://wiki.example.internal",
"groups": [
"internal",
"vpn"
]
},
{
"icon": "fa-brands fa-mastodon",
"name": "Mastodon",
"url": "https://mastodon.example.internal",
"groups": [
"internal",
"vpn"
]
},
{
"icon": "fa-brands fa-google",
"name": "Google",
"url": "https://www.google.com",
"groups": []
},
{
"icon": "fa-brands fa-youtube",
"name": "Youtube",
"url": "https://www.youtube.com",
"groups": []
},
{
"icon": "fa-brands fa-stack-overflow",
"name": "StackOverflow",
"url": "https://stackoverflow.com",
"groups": []
}
],
"notes": [
Expand All @@ -154,19 +54,9 @@
"vpn"
]
},
{
"name": "Global note",
"text": "This note will be visible to everyone",
"groups": []
},
{
"name": "How to use our internal services",
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec arcu purus. Maecenas ut erat ut tellus vulputate pellentesque sit amet quis metus. Praesent sollicitudin ultricies leo. Sed ornare libero non vehicula cursus. Aliquam vulputate pulvinar elit, sit amet tempus justo condimentum in. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus",
"groups": []
},
{
"name": "Another note",
"text": "Another note for internal network users only",
"text": "Another note for internal users only",
"groups": [
"internal"
]
Expand Down
Loading

0 comments on commit 5ff9885

Please sign in to comment.