Bun Project Hosted on Railway

Hi, somehow it doesnt use my .config file instead jsut takes the VARIABLE values how can i tell Railway to use my config
34 Replies
Percy
Percy12mo ago
Project ID: N/A
harmoney19
harmoney19OP12mo ago
N/A
Brody
Brody12mo ago
what does this .config file do? are you sure you aren't accidentally .gitignore'ing it?
harmoney19
harmoney19OP12mo ago
ervices: web: image: codeberg.org/hkau/entry:latest restart: unless-stopped ports:
"8080:8080" # match this (both sides) with your values from env.port environment: PORT: "8080" # optional, 8080 is default NAME: "Entry" # optional, Entry is default ADMIN_PASSWORD: "xyz" # Your updated admin password DATA_LOCATION: ":cwd/data" # optional, :cwd/data is default, only used during first setup# edit within config file, this value is only used to prefill the value in config.json CONFIG_LOCATION: ":cwd/data/config.json" # optional, :cwd/data/config.json is default EDITABLE_BY_DEFAULT: true # optional, sets if pastes are editable by default, true is default so thats my docker compose and here i specified a config file but somehow thats not wokring for example its still also using Port 8080 even tho i specified it in my config.json that it should use 80 But when i add a new Project Variable with "PORT" and value 80 its wokring
Brody
Brody12mo ago
1. docker compose is not supported 2. please use service variables to specify your environment variables https://docs.railway.app/guides/variables#service-variables 3. read this https://docs.railway.app/guides/fixing-common-errors
harmoney19
harmoney19OP12mo ago
can i use a service variable to specify my config? will it use that then
Brody
Brody12mo ago
you use service variables to specify environment variables
harmoney19
harmoney19OP12mo ago
thanks helped me alot somehow it still doesnt use my config, can i somehow check if i configured the right path i mean if it existsd
Brody
Brody12mo ago
are you sure the config file is making it into your repo?
harmoney19
harmoney19OP12mo ago
its exiusitng in my git repo yeah
Brody
Brody12mo ago
how are you opening the config file in code?
harmoney19
harmoney19OP12mo ago
but idk if its not jsut creating a new image from the docker-compose
Brody
Brody12mo ago
like i said, railway does not support docker compose
harmoney19
harmoney19OP12mo ago
unfortunally im not the dev, but its wokring on his environment data/config.json heres my config :cwd/data/config.json thats how i specified it is that correct?
Brody
Brody12mo ago
please show your code
harmoney19
harmoney19OP12mo ago
can i add u to my repo? github
Brody
Brody12mo ago
for now, a screenshot of the code that opens the config file will be just fine
harmoney19
harmoney19OP12mo ago
okay one sec config.config = optional( "\x1b[92mEnter config location\x1b[0m", ":cwd/data/config.json", "CONFIG_LOCATION" ); i think here
Brody
Brody12mo ago
screenshot of code please
harmoney19
harmoney19OP12mo ago
/**
* @file Start Entry server * @name index.ts * @license MIT */ import path from "node:path"; import fs from "node:fs"; // ...EntryDB import EntryDB from "./classes/db/EntryDB"; import type { LogEvent } from "./classes/db/objects/Log"; import API from &qu...
harmoney19
harmoney19OP12mo ago
code is correct cause on my devs environment its wokring
Brody
Brody12mo ago
sorry that doesnt always mean the code is without issues
harmoney19
harmoney19OP12mo ago
it is so its more on config site (100%)
Brody
Brody12mo ago
this is 100% a code issue
harmoney19
harmoney19OP12mo ago
ADMIN_PASSWORD ** CONFIG_LOCATION ** EDITABLE_BY_DEFAULT ** NAME ** PORT *** ive addet these variables so shouldnt it just open it
Brody
Brody12mo ago
i dont see how :cwd makes it a valid path either way, you should not be storing anything sensitve in a plaintext file like a json file, please use environment variables
harmoney19
harmoney19OP12mo ago
DATABASE_PRIVATE_URL ** DATABASE_URL ** PGDATA ** PGDATABASE ** PGHOST ** PGPASSWORD 2Edd543165be3caGBBe6654-AgGD-1 PGPORT 54256 PGUSER ** POSTGRES_DB ** POSTGRES_PASSWORD ** POSTGRES_USER ** SSL_CERT_DAYS ** so tats my Postegres database also hosted on Railway: "pg": { "host": "x", "user": "postgres", "password": "x-AgGD-1", "database": "railway", "logdb": true, "port": 54256 }
so what of these values do i have to use here?
Brody
Brody12mo ago
please go back and enclose your code in triple back ticks
harmoney19
harmoney19OP12mo ago
ohh thatzs not code thats just the values of my Postrges database and my config section
Brody
Brody12mo ago
im aware, but please enclose it in triple back ticks
harmoney19
harmoney19OP12mo ago
DATABASE_PRIVATE_URL
**



DATABASE_URL
**



PGDATA
**



PGDATABASE
**



PGHOST
**



PGPASSWORD
2Edd543165be3caGBBe6654-AgGD-1



PGPORT
54256



PGUSER
**



POSTGRES_DB
**



POSTGRES_PASSWORD
**



POSTGRES_USER
**



SSL_CERT_DAYS
**



so tats my Postegres database also hosted on Railway: "pg": {
"host": "x",
"user": "postgres",
"password": "x-AgGD-1",
"database": "railway",
"logdb": true,
"port": 54256
}
DATABASE_PRIVATE_URL
**



DATABASE_URL
**



PGDATA
**



PGDATABASE
**



PGHOST
**



PGPASSWORD
2Edd543165be3caGBBe6654-AgGD-1



PGPORT
54256



PGUSER
**



POSTGRES_DB
**



POSTGRES_PASSWORD
**



POSTGRES_USER
**



SSL_CERT_DAYS
**



so tats my Postegres database also hosted on Railway: "pg": {
"host": "x",
"user": "postgres",
"password": "x-AgGD-1",
"database": "railway",
"logdb": true,
"port": 54256
}
Brody
Brody12mo ago
please use environment variables instead of json config files i may also be helpful to have your dev join this thread
harmoney19
harmoney19OP12mo ago
hes not available the next 2 weeks unfortunally but can u tell me steps by step again what normally to do that my config applys but the db is nested how to do that
Brody
Brody12mo ago
Want results from more Discord servers?
Add your server