Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added air toml with paths for windows #90

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
cmd = "make build"
cmd = "go build -v -o .\\tmp\\urchin.exe .\\cmd\\urchin"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you pushed this as a mistake too

args_bin = []
bin = "./tmp/urchin"
full_bin = "./tmp/urchin --config urchin_config.toml"
bin = ".\\tmp\\urchin.exe"
full_bin = ".\\tmp\\urchin.exe --config urchin_config.toml.exe"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
Expand Down Expand Up @@ -43,4 +43,4 @@ tmp_dir = "tmp"

[screen]
clear_on_rebuild = false
keep_scroll = true
keep_scroll = true
46 changes: 46 additions & 0 deletions .air_windows.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
cmd = "go build -v -o .\\tmp\\urchin.exe .\\cmd\\urchin"
args_bin = []
bin = ".\\tmp\\urchin.exe"
full_bin = ".\\tmp\\urchin.exe --config urchin_config.toml.exe"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_templ.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "templ", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
keep_scroll = true
2 changes: 1 addition & 1 deletion Makefile → Makefile Windows
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ URCHIN_DIR=./cmd/urchin
URCHIN_ADMIN_DIR=./cmd/urchin-admin

# Name of the binary
BINARY_NAME=urchin
BINARY_NAME=urchin.exe
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't think we need this Makefile Windows file - the windows .air_windows.toml file doesn't reference it at all.

ADMIN_BINARY_NAME=urchin-admin

all: build test
Expand Down
46 changes: 46 additions & 0 deletions air_windows.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
root = "."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this file to .air_windows.toml - Keeps it hidden for the linux guys

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You renamed the file and pushed the new name, but this is still here! You can push the "removed" file from git, it should appear as deleted when you do a git status - just do git add .ait_windows.toml after the deletion, and the commit it after that.

testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
cmd = "go build -v -o .\\tmp\\urchin.exe .\\cmd\\urchin"
args_bin = []
bin = ".\\tmp\\urchin.exe"
full_bin = ".\\tmp\\urchin.exe --config urchin_config.toml.exe"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_templ.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "templ", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
keep_scroll = true
30 changes: 15 additions & 15 deletions migrations/20240116222307_add_complex_post_example.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-- +goose Up
-- +goose StatementBegin
INSERT INTO posts(title, content, excerpt) VALUES(
'My Very First Post',
'# Urchin 🐚
'My Second Post',
'# CMS FOR GO

Urchin is a headless CMS (Content Management System) written in Golang, designed to be fast, efficient, and easily extensible. It allows you to
CMS FOR GO is a headless CMS (Content Management System) written in Golang, designed to be fast, efficient, and easily extensible. It allows you to
create a website or blog, with any template you like, in only a few
commands.

## Features 🚀
## Features

- **Headless Architecture:** Adding pages, posts, or forms should all
be done with easy requests to the API.
Expand All @@ -21,7 +21,7 @@ commands.
Ensure you have Golang installed on your system before proceeding with the installation.

```bash
go get -u github.com/username/urchin
go get -u github.com/username/CMSGO
```

## Example - Running the App
Expand All @@ -31,17 +31,17 @@ template, simply build and start the app with the following commands.

```bash
go build
./urchin
./cms-for-go
```

This will start Urchin on `http://localhost:8080`. You can customize
This will start CMS FOR GO on `http://localhost:8080`. You can customize
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to push these changes to the PR? I think these shouldn't be here

the configuration by providing the necessary environment variables.

For more information, see the [configuration settings](#configuration).

## Dependencies

Urchin relies on the following Golang dependencies:
CMSGO relies on the following Golang dependencies:

- [Gin](github.com/gin-gonic/gin) as the web framework for Golang.
- [ZeroLog](https://github.com/rs/zerolog) for logging.
Expand All @@ -54,22 +54,22 @@ it makes integrating `envfile`s quite easy.

The following list outlines the environment variables needed.

- `URCHIN_DATABASE_ADDRESS` should contain the database addres,
- `CMSGO_DATABASE_ADDRESS` should contain the database addres,
e.g. `localhost`.
- `URCHIN_DATABASE_PORT` should be the connection port to the
- `CMSGO_DATABASE_PORT` should be the connection port to the
database. For example `3306`.
- `URCHIN_DATABASE_USER` is the database username.
- `URCHIN_DATABASE_PASSWORD` needs to contain the database
- `CMSGO_DATABASE_USER` is the database username.
- `CMSGO_DATABASE_PASSWORD` needs to contain the database
password for the given user.

## License

Urchin is released under the MIT License. See LICENSE (TODO) for
CMS FOR GO is released under the MIT License. See LICENSE (TODO) for
details. Feel free to fork, modify, and use it in your projects!',
'This is Urchin! This post is an example of how markdown can be rendered as a post.');
'This is CMS FOR GO! This post is an example of how markdown can be rendered as a post.');
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DELETE FROM posts ORDER BY id DESC LIMIT 1;
-- +goose StatementEnd
-- +goose StatementEnd
41 changes: 41 additions & 0 deletions urchin_windows_config.toml.exe
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Address to the MariaDB database
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to have any windows-only changes from the urchin_config.toml file - do we need this? If not, we can also remove from PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows reads the config.toml only as a .exe in order to run Air. =)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're mistaken here, this file is running from urchin so as long as --config urchin_config.toml is passed to urchin you should be fine. That's why I don't think we need this here.

For example, in your .air_windows.toml you just need

full_bin = ".\\tmp\\urchin.exe --config urchin_config.toml"

database_address = "localhost"

# User to access datbaase
database_user = "urchin"

# Password for the database user
database_password = "urchinpw"

# port
database_port = 3306

# name of database where urchin's
# migrations was installed
database_name = "urchin"

# port to run the webserver on
webserver_port = 8080

# port to run the admin app on
admin_port = 8081

# Directory to use for storing uploaded images.
image_dir = "./images"

# Enable/disable endpoint cache
cache_enabled = true

# Recaptcha settings
recaptcha_sitekey = "6LecCewpAAAAAK7QS2SwuyCIDzwlyXMs4J1Z5LBq"
recaptcha_secret = "6LecCewpAAAAAPP8Aaxh6jWaDE1xG_MBQa1OOs8f"


[navbar]
links = [
{ name = "Home", href = "/", title = "Homepage" },
{ name = "About", href = "/about", title = "About page" },
{ name = "Services", href = "/services", title = "Services page" },
{ name = "Images", href = "/images", title = "Images page" },
{ name = "Contact", href = "/contact", title = "Contacts page" },
]