Skip to content

Commit 5cc46a1

Browse files
committed
We are so codespacey!
1 parent 29b7d79 commit 5cc46a1

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

Makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Define the default target
2+
.PHONY: all
3+
all: build
4+
5+
# Build the Rust project
6+
.PHONY: build
7+
build:
8+
@echo "Building the project"
9+
cargo build --release
10+
11+
# Run the Rust project
12+
.PHONY: run
13+
run:
14+
@echo "Running the project with RUST_LOG='$(RUST_LOG)'"
15+
RUST_LOG=$(RUST_LOG) cargo run
16+
17+
# Clean the project
18+
.PHONY: clean
19+
clean:
20+
cargo clean
21+
22+
# Test the project
23+
.PHONY: test
24+
test:
25+
@echo "Running tests..."
26+
cargo test
27+
28+
# Format the code
29+
.PHONY: format
30+
format:
31+
cargo fmt
32+
33+
# Check the code
34+
.PHONY: check
35+
check:
36+
cargo clippy
37+
cargo check
38+
39+
# Prepare the sqlx
40+
.PHONY: prepare
41+
prepare:
42+
cargo sqlx prepare
43+
44+
# Run migrations
45+
.PHONY: migrate
46+
migrate:
47+
cargo sqlx migrate run

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,22 @@ Building and running the thing has a few requirements:
1616
* An account with [Cloudflare](https://www.cloudflare.com/) with an API Token scoped for `Zone.Cache Purge`, credentials in config.toml
1717
* An application registered with [Discord](https://discord.dev/), credentials in config.toml
1818

19-
## How to use
19+
## How to use (with Codespaces)
20+
* Be signed into GitHub and click on the green `Code` button in the top right corner of the repository
21+
* Select Codespaces tab and click on the `Create codespace`
22+
* Let the thing wriggle and build for a bit! It takes a while for the first time
23+
* Click on forwarded ports and open the address for port 9001 in your browser
24+
* Input `minioadmin` for username and password in it!
25+
* Make a new bucket called `pastebin` in there and copy `confs/s3/bucket-policy.json` into its custom access policy
26+
* Make a new key in there and copy `confs/s3/key-policy.json` into its user policy, make sure to note down the access key and secret key!
27+
* Copy config.toml.sample to a file called config.toml and edit for correct values
28+
* The codespace domain for port 2024 goes in `static_domain` in config.toml
29+
* The codespace address+`pastebin/` for port 9000 goes in `s3_bucket_url` in config.toml
30+
* Open the terminal and type `make migrate`, `make check`, and then `make run`
31+
* Open the address for the forwarded port 2024 in your browser!
32+
* Tada!
33+
34+
## How to use (Old school way)
2035

2136
* Clone the repository with `git clone https://github.com/adayoung/ada-pastebin`
2237
* Copy config.toml.sample to a file called config.toml and edit for correct values

config.toml.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
static_domain = "localhost:2024"
2-
bind_addr = "127.0.0.1"
2+
bind_addr = "0.0.0.0"
33
port = 2024
44

55
cookie_key="<stick a 64 character long random gibberish here!>"

0 commit comments

Comments
 (0)