fix: change hard-coded server ip and create note in readme

pull/22/head
Laurin Weger 6 months ago
parent 9227ae33a4
commit 16466b720a
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 1
      .gitignore
  2. 5
      ngaccount/.env
  3. 16
      ngaccount/README.md
  4. 7
      ngaccount/src/main.rs
  5. 2
      ngaccount/web/src/routes/Create.svelte
  6. 2
      ngaccount/web/src/routes/Delete.svelte

1
.gitignore vendored

@ -14,3 +14,4 @@ node_modules
*/tests/*.mnemonic */tests/*.mnemonic
*/ng-example/* */ng-example/*
.vscode/settings.json .vscode/settings.json
.env.local

@ -0,0 +1,5 @@
NG_ACCOUNT_DOMAIN=
NG_ACCOUNT_ADMIN=
NG_ACCOUNT_LOCAL_PEER_KEY=
NG_ACCOUNT_SERVER=127.0.0.1,1440,[the broker's peer ID]
RUST_LOG=

@ -12,16 +12,24 @@ pnpm --ignore-workspace install
## Dev ## Dev
``` ```bash
cd web cd web
pnpm run dev --host pnpm run dev --host
// in another terminal
# In another terminal...
cd ../ cd ../
export NG_ACCOUNT_DOMAIN=[?]; export NG_ACCOUNT_ADMIN=[?]; export NG_ACCOUNT_LOCAL_PEER_KEY=[?]; export NG_ACCOUNT_SERVER=127.0.0.1,14400,[?]; export RUST_LOG=debug
# Please set the required environment variables in the .env and then source it it with:
source .env
cargo watch -c -w src -x run cargo watch -c -w src -x run
// then open http://localhost:5173/ # Then open http://localhost:5173/#/create
``` ```
> TODO:
> Currently, the ng-account server api is listening on http://127.0.0.1:3031 only which might cause you trouble.
> See files: `main.rs`, `Create.svelte` and `Delete.svelte`.
## Prod ## Prod
``` ```

@ -258,7 +258,7 @@ async fn main() -> anyhow::Result<()> {
"Content-Security-Policy", "Content-Security-Policy",
HeaderValue::from_static( HeaderValue::from_static(
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
"default-src 'self' data:; connect-src ipc: https://ipc.localhost 'self' http://192.168.192.2:3031", "default-src 'self' data:; connect-src ipc: https://ipc.localhost 'self' http://localhost:3031",
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
"default-src 'self' data:; connect-src ipc: https://ipc.localhost 'self'", "default-src 'self' data:; connect-src ipc: https://ipc.localhost 'self'",
@ -304,9 +304,10 @@ async fn main() -> anyhow::Result<()> {
{ {
log_debug!("CORS: any origin"); log_debug!("CORS: any origin");
cors = cors.allow_any_origin(); cors = cors.allow_any_origin();
log::info!("Starting server on http://192.168.192.2:3031"); log::info!("Starting server on http://localhost:3031");
warp::serve(api_v1.or(static_files).with(cors).with(incoming_log)) warp::serve(api_v1.or(static_files).with(cors).with(incoming_log))
.run(([192, 168, 192, 2], 3031)) // TODO: Change this to local network ip?
.run(([127, 0, 0, 1], 3031))
.await; .await;
} }

@ -27,7 +27,7 @@
let top; let top;
const api_url = import.meta.env.PROD const api_url = import.meta.env.PROD
? "api/v1/" ? "api/v1/"
: "http://192.168.192.2:3031/api/v1/"; : "http://127.0.0.1:3031/api/v1/";
async function register() { async function register() {
wait = true; wait = true;

@ -27,7 +27,7 @@
let top; let top;
const api_url = import.meta.env.PROD const api_url = import.meta.env.PROD
? "api/v1/" ? "api/v1/"
: "http://192.168.192.2:3031/api/v1/"; : "http://127.0.0.1:3031/api/v1/";
async function bootstrap() {} async function bootstrap() {}
let error; let error;

Loading…
Cancel
Save