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
Project ID:
N/A
N/A
what does this .config file do?
are you sure you aren't accidentally .gitignore'ing it?
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
"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
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
can i use a service variable to specify my config?
will it use that then
you use service variables to specify environment variables
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
are you sure the config file is making it into your repo?
its exiusitng in my git repo yeah
how are you opening the config file in code?
but idk if its not jsut creating a new image from the docker-compose
like i said, railway does not support docker compose
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?
please show your code
can i add u to my repo?
github
for now, a screenshot of the code that opens the config file will be just fine
okay one sec
config.config = optional(
"\x1b[92mEnter config location\x1b[0m",
":cwd/data/config.json",
"CONFIG_LOCATION"
);
i think here
screenshot of code please
/**
* @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...
code is correct cause on my devs environment its wokring
sorry that doesnt always mean the code is without issues
it is so its more on config site (100%)
this is 100% a code issue
ADMIN_PASSWORD
**
CONFIG_LOCATION
**
EDITABLE_BY_DEFAULT
**
NAME
**
PORT
***
ive addet these variables so shouldnt it just open it
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 variablesDATABASE_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?
so what of these values do i have to use here?
please go back and enclose your code in triple back ticks
ohh thatzs not code thats just the values of my Postrges database and my config section
im aware, but please enclose it in triple back ticks
please use environment variables instead of json config files
i may also be helpful to have your dev join this thread
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
code changes are needed, please read https://docs.railway.app/guides/variables#service-variables