-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update readme, added http port flag, add buildroot package files
- Loading branch information
Showing
6 changed files
with
69 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
# go-simple-http-server | ||
Super simple golang HTTP | ||
|
||
Super simple golang HTTP server with example systemd service file and buildroot package. | ||
|
||
## Buildroot | ||
|
||
Copy the files buildroot/* using the same directory structure into your buildroot directory. | ||
|
||
Add the following line to the buildroot/package/Config.in file typically under the 'menu "Miscellaneous"' line. | ||
|
||
`source "package/go-simple-http-server/Config.in"` | ||
|
||
Run `make menuconfig` and enable your new 'go-simple-http-server' under Packages -> Miscellaneous. | ||
|
||
## Usage | ||
``` | ||
Usage of go-simple-http-server: | ||
-port int | ||
http port (default 80) | ||
-www string | ||
directory with files to be served (default "www") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
config BR2_PACKAGE_GO_SIMPLE_HTTP_SERVER | ||
bool "go-simple-http-server" | ||
help | ||
Super simple go http server to prove golang apps can be built with buildroot |
37 changes: 37 additions & 0 deletions
37
buildroot/package/go-simple-http-server/go-simple-http-server.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
################################################################################ | ||
# | ||
# Go Simple Http Server | ||
# | ||
################################################################################ | ||
|
||
GO_SIMPLE_HTTP_SERVER_VERSION = 0.4 | ||
GO_SIMPLE_HTTP_SERVER_SITE = $(call github,kgolding,go-simple-http-server,$(GO_SIMPLE_HTTP_SERVER_VERSION)) | ||
GO_SIMPLE_HTTP_SERVER_LICENSE = MIT | ||
GO_SIMPLE_HTTP_SERVER_LICENSE_FILES = LICENSE | ||
|
||
GO_SIMPLE_HTTP_SERVER_DESTDIR = /usr/share/go-simple-http-server | ||
|
||
# Remove go DWARF dubgging table to shrink the binary a bit | ||
GO_SIMPLE_HTTP_SERVER_LDFLAGS = -s -w | ||
|
||
define GO_SIMPLE_HTTP_SERVER_PRE_INSTALL_TARGET_HOOKS | ||
# Create directory | ||
$(INSTALL) -d $(TARGET_DIR)$(GO_SIMPLE_HTTP_SERVER_DESTDIR)/www/ | ||
# Install www assets | ||
find $(@D)/www/ -type f -exec $(INSTALL) -m 0644 -D "{}" $(TARGET_DIR)$(GO_SIMPLE_HTTP_SERVER_DESTDIR)/www/ \; | ||
endef | ||
|
||
# Add Systemd service | ||
define GO_SIMPLE_HTTP_SERVER_INSTALL_INIT_SYSTEMD | ||
# Install systemd service file | ||
$(INSTALL) -D -m 0644 $(@D)/systemd.service \ | ||
$(TARGET_DIR)/usr/lib/systemd/system/go-simple-http-server.service | ||
|
||
# Enable the service to auto start by symlinking the file | ||
mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants | ||
ln -sf /usr/lib/systemd/system/go-simple-http-server.service \ | ||
$(TARGET_DIR)//etc/systemd/system/multi-user.target.wants/go-simple-http-server.service | ||
endef | ||
|
||
# The binary will be installed as /usr/bin/go-simple-http-server | ||
$(eval $(golang-package)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters