diff --git a/docker-compose.yml b/docker-compose.yml index 8e65b7e..73a8825 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: nginx: image: nginx:alpine + restart: always ports: - '3001:3001' - '6661:6661' diff --git a/ohbug.config.yml b/ohbug.config.yml index 850643c..f37b7b4 100644 --- a/ohbug.config.yml +++ b/ohbug.config.yml @@ -1,9 +1,5 @@ http: - url: 127.0.0.1 - -# https: -# key: ./secrets/key.pem -# cert: ./secrets/cert.pem + url: http://localhost:3000 db: postgres: diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index 63cb7ef..56d7dc2 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -11,10 +11,6 @@ export interface Config { http: { url: string } - https?: { - key: string - cert: string - } db: { postgres: { host: string diff --git a/scripts/createEnv.ts b/scripts/createEnv.ts index 5647648..d239fd9 100755 --- a/scripts/createEnv.ts +++ b/scripts/createEnv.ts @@ -8,23 +8,22 @@ import type { Config } from '../packages/config' const YAML_CONFIG_FILENAME = 'ohbug.config.yml' const DEVELOP_YAML_CONFIG_FILENAME = 'ohbug.config.development.yml' const FILE_NAME = '.env' +const WEB_PORT = 3000 async function main() { const rootFilePath = join(cwd(), FILE_NAME) const webFilePath = join(cwd(), 'packages/web', FILE_NAME) const configPath = join(cwd(), process.env.NODE_ENV === 'development' ? DEVELOP_YAML_CONFIG_FILENAME : YAML_CONFIG_FILENAME) const config = yaml.load(await readFile(configPath, 'utf8')) as Config - const httpPrefix = config.https ? 'https' : 'http' - const port = config.https ? 3001 : 3000 const fileContents = `NEXT_PUBLIC_VERSION=${pkg.version} DB_USER=${config.db.postgres.user} DB_PASSWORD=${config.db.postgres.password} DB_NAME=${config.db.postgres.database} DATABASE_URL="postgresql://${config.db.postgres.user}:${config.db.postgres.password}@${config.db.postgres.host}:${config.db.postgres.port}/${config.db.postgres.database}" -NEXTAUTH_URL=${httpPrefix}://${config.http.url}:${port} -NEXTAUTH_URL_INTERNAL=http://localhost:3000 +NEXTAUTH_URL=${config.http.url} +NEXTAUTH_URL_INTERNAL=http://localhost:${WEB_PORT} NEXTAUTH_SECRET=${config.secret?.session ?? 'ohbug-session-s3cret'} -NEXT_PUBLIC_NEXTAUTH_URL=${httpPrefix}://${config.http.url}:${port} +NEXT_PUBLIC_NEXTAUTH_URL=${config.http.url} ` await writeFile(rootFilePath, fileContents) await writeFile(webFilePath, fileContents)