Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PORT=
HOST=
DISCORD_ID=
DISCORD_SECRET=
JWT_SECRET=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
**/target
**/build
**.idea
**.vscode
**.iml
/node_modules
/.pnp
.pnp.js
pnpm-debug.log*
.env
Copy link
Copy Markdown
Owner

@rushiiMachine rushiiMachine Sep 30, 2022

Choose a reason for hiding this comment

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

Husk I meant:

  1. keep .env as a sample file
  2. document the user copying .env to .env.local
  3. Load from .env.local

This makes .env is reserved in git as an example file

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

wrong

7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ include_dir = "0.7"
lazy_static = "1.4"
thiserror = "1.0"
either = "1.7"
kankyo = "0.3"

# Explicit dependency to compile openssl from openssl-src instead as a workaround for cross-compilation
openssl = { version = "0.10", features = ["vendored"] }
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ARG TARGETARCH
RUN rustup target add $(echo $TARGETARCH | sed 's/arm64/aarch64/;s/amd64/x86_64/')-unknown-linux-musl

ADD build.rs ./
ADD .env ./
ADD src ./src
COPY --from=REACT_BUILD /app/build ./build

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ variable below. Copy the secret and id from the OAuth tab to set as environment

### Environment variables

Can be modified in the [.env](./.env.example) file.

| PORT | TYPE | Default | Description |
|------------------|--------|------------------------------------------------------|------------------------------------------------------------------------------|
| `PORT` | u16 | 8000 (unmodifiable in debug) | The port to serve the app on |
Expand All @@ -26,7 +28,10 @@ variable below. Copy the secret and id from the OAuth tab to set as environment
$ pnpm install
$ pnpm build
$ cargo build --release
# Set environment variables manually
$ export PORT=<port>;DISCORD_ID=<id>;DISCORD_SECRET=<secret>;HOST=<host>;JWT_SECRET=<key>POSTGRES_URL=<connection_string>;
# or using .env
$ mv .env.example .env
$ ./target/release/timezone_db
```

Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ mod database;

#[launch]
fn rocket() -> Rocket<Build> {
if let Err(e) = kankyo::init() {
println!("{e}");
};
let figment = Config::figment()
.merge(("port", *constants::PORT))
.merge(("databases.main.url", &*constants::POSTGRES_URL))
Expand Down