You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Move GitHub secrets and deployment trigger into a dedicated Deployment section
- Add Configuration parent heading for Environment Variables and Server Settings
- Fix Windows Development code block indentation
- Normalise copyright years to 2020-2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Google Maps API key with Maps JavaScript API enabled
28
-
29
20
## Local Development
30
21
31
22
1.**Clone the repository**
@@ -40,10 +31,8 @@ A web application that calculates and displays moon rise and set times for any l
40
31
```
41
32
42
33
3.**Set up environment variables**
43
-
```bash
44
-
cp .env.example .env
45
-
```
46
-
Edit `.env` and set your values:
34
+
Use .env.example to create your own .env file
35
+
47
36
```env
48
37
GOOGLE_MAPS_API_KEY=your_actual_api_key_here
49
38
PROD=False
@@ -61,43 +50,20 @@ A web application that calculates and displays moon rise and set times for any l
61
50
- For local development: `http://localhost:8484/*`
62
51
-**API restrictions**: Restrict key to "Maps JavaScript API" only
63
52
- Set usage quotas to prevent abuse
64
-
65
-
> **Security Note**: Google Maps JavaScript API keys are client-side visible by design. The security comes from properly configuring API key restrictions in Google Cloud Console, not from hiding the key.
66
-
67
-
## Running the Application
68
-
69
-
### Development
70
53
71
-
```bash
72
-
# Load environment variables and run
73
-
go run moon.go
74
-
```
75
-
76
-
The server will start on `http://localhost:8484`
54
+
> **Security Note**: Google Maps JavaScript API keys are client-side visible by design. The security comes from properly configuring API key restrictions in Google Cloud Console, not from hiding the key.
77
55
78
56
### Windows Development
79
57
80
-
Use the provided batch files:
81
-
82
-
1.**First time setup:**
83
-
```cmd
84
-
build.bat
85
-
```
86
-
This will:
87
-
- Build the application
88
-
- Create `.env` from `.env.example` if missing
89
-
- Prompt you to add your API key
58
+
```cmd
59
+
build.bat
60
+
```
90
61
91
-
2.**Edit `.env`** and replace the placeholder with your actual API key
62
+
Or for quick restart (when already built):
92
63
93
-
3.**Run the application:**
94
-
```cmd
95
-
build.bat
96
-
```
97
-
or for quick restart (when already built):
98
-
```cmd
99
-
run.bat
100
-
```
64
+
```cmd
65
+
run.bat
66
+
```
101
67
102
68
### Cross-Compilation (Building for Linux from Windows)
103
69
@@ -108,220 +74,21 @@ set GOARCH=amd64
108
74
go build -o moon
109
75
```
110
76
111
-
**Build for Debian/Ubuntu (arm64 - Raspberry Pi, etc):**
112
-
```cmd
113
-
set GOOS=linux
114
-
set GOARCH=arm64
115
-
go build -o moon
116
-
```
117
-
118
77
**Build for Windows (local):**
119
78
```cmd
120
79
set GOOS=windows
121
80
set GOARCH=amd64
122
81
go build -o moon.exe
123
82
```
124
83
125
-
Or use PowerShell:
126
-
```powershell
127
-
$env:GOOS="linux"; $env:GOARCH="amd64"; go build -o moon
128
-
```
129
-
130
-
Then upload the `moon` binary to your Debian server.
131
-
132
-
### Production
133
-
134
-
```bash
135
-
# Build the binary
136
-
go build -o moon
137
-
138
-
# Set environment variables
139
-
export GOOGLE_MAPS_API_KEY="your_key_here"
140
-
export PROD="True"
141
-
142
-
# Run the server
143
-
./moon
144
-
```
145
-
146
-
### Using systemd (Linux)
147
-
148
-
1. Build and install the binary:
149
-
```bash
150
-
go run moon.go
151
-
```
152
-
The server starts on `http://localhost:8484`
153
-
154
-
### Google Maps API Key
155
-
156
-
- Go to [Google Cloud Console](https://console.cloud.google.com/)
157
-
- Enable "Maps JavaScript API" and create an API key
158
-
- Restrict the key to HTTP referrers (`http://localhost:8484/*` for dev, your domain for prod) and to "Maps JavaScript API" only
159
-
160
-
4. Install and enable the service:
161
-
```bash
162
-
sudo cp moon.service /etc/systemd/system/
163
-
sudo systemctl daemon-reload
164
-
sudo systemctl enable moon
165
-
sudo systemctl start moon
166
-
sudo systemctl status moon
167
-
```
168
-
169
-
### Debian/Ubuntu Production Deployment
170
-
171
-
#### 1. Deploy Application
172
-
173
-
```bash
174
-
# Create application directory
175
-
sudo mkdir -p /var/www/moon
176
-
sudo chown $USER:$USER /var/www/moon
177
-
178
-
# Clone or copy your application
179
-
cd /var/www/moon
180
-
# ... copy your files here ...
181
-
182
-
# Install dependencies
183
-
go mod download
184
-
185
-
# Build the application
186
-
go build -o moon
187
-
188
-
# Make executable
189
-
chmod +x moon
190
-
```
191
-
192
-
#### 2. Build and Install Binary
193
-
194
-
```bash
195
-
# Build for Linux (if cross-compiling from Windows, see Cross-Compilation section)
0 commit comments