mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
Merge pull request #2124 from logto-io/gao-clean-up-core-inquiry
refactor(core): remove parameters
This commit is contained in:
commit
343456f44d
7 changed files with 10 additions and 27 deletions
|
@ -15,8 +15,6 @@ tasks:
|
|||
pnpm cli db seed
|
||||
pnpm lerna --ignore=@logto/integration-test run --parallel dev
|
||||
env:
|
||||
ALL_YES: 1
|
||||
NO_INQUIRY: 0
|
||||
TRUST_PROXY_HEADER: 1
|
||||
DB_URL: postgres://postgres:p0stgr3s@127.0.0.1:5432
|
||||
|
||||
|
|
1
packages/core/.gitignore
vendored
1
packages/core/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
/alterations
|
|
@ -40,6 +40,7 @@
|
|||
"deepmerge": "^4.2.2",
|
||||
"dotenv": "^16.0.0",
|
||||
"etag": "^1.8.1",
|
||||
"find-up": "^5.0.0",
|
||||
"fs-extra": "^10.1.0",
|
||||
"got": "^11.8.2",
|
||||
"hash-wasm": "^4.9.0",
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
import { appendFileSync } from 'fs';
|
||||
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
import { fromRoot } from './parameters';
|
||||
import findUp from 'find-up';
|
||||
|
||||
export const appendDotEnv = (key: string, value: string) => {
|
||||
appendFileSync('.env', `${key}=${value}\n`);
|
||||
};
|
||||
|
||||
export const configDotEnv = () => {
|
||||
if (fromRoot) {
|
||||
dotenv.config({ path: '../../.env' });
|
||||
} else {
|
||||
dotenv.config();
|
||||
}
|
||||
export const configDotEnv = async () => {
|
||||
dotenv.config({ path: await findUp('.env', {}) });
|
||||
};
|
||||
|
|
|
@ -1,9 +1,2 @@
|
|||
import { getEnv } from '@silverhand/essentials';
|
||||
|
||||
export const isTrue = (value: string) =>
|
||||
['1', 'true', 'y', 'yes', 'yep', 'yeah'].includes(value.toLowerCase());
|
||||
|
||||
const parameters = new Set(process.argv.slice(2));
|
||||
export const noInquiry = parameters.has('--no-inquiry') || isTrue(getEnv('NO_INQUIRY'));
|
||||
export const fromRoot = parameters.has('--from-root') || isTrue(getEnv('FROM_ROOT'));
|
||||
export const allYes = parameters.has('--all-yes') || isTrue(getEnv('ALL_YES'));
|
||||
|
|
|
@ -2,22 +2,17 @@ import 'module-alias/register';
|
|||
|
||||
import Koa from 'koa';
|
||||
|
||||
// eslint-disable-next-line import/order
|
||||
import { configDotEnv } from './env-set/dot-env';
|
||||
|
||||
configDotEnv();
|
||||
|
||||
/* eslint-disable import/first */
|
||||
import initApp from './app/init';
|
||||
import { initConnectors } from './connectors';
|
||||
import envSet from './env-set';
|
||||
import { configDotEnv } from './env-set/dot-env';
|
||||
import initI18n from './i18n/init';
|
||||
/* eslint-enable import/first */
|
||||
|
||||
// Update after we migrate to ESM
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await
|
||||
(async () => {
|
||||
try {
|
||||
await configDotEnv();
|
||||
await envSet.load();
|
||||
const app = new Koa({
|
||||
proxy: envSet.values.trustProxyHeader,
|
||||
|
|
|
@ -275,6 +275,7 @@ importers:
|
|||
dotenv: ^16.0.0
|
||||
eslint: ^8.21.0
|
||||
etag: ^1.8.1
|
||||
find-up: ^5.0.0
|
||||
fs-extra: ^10.1.0
|
||||
got: ^11.8.2
|
||||
hash-wasm: ^4.9.0
|
||||
|
@ -331,6 +332,7 @@ importers:
|
|||
deepmerge: 4.2.2
|
||||
dotenv: 16.0.0
|
||||
etag: 1.8.1
|
||||
find-up: 5.0.0
|
||||
fs-extra: 10.1.0
|
||||
got: 11.8.3
|
||||
hash-wasm: 4.9.0
|
||||
|
@ -4035,7 +4037,7 @@ packages:
|
|||
'@jest/types': 28.1.3
|
||||
deepmerge: 4.2.2
|
||||
identity-obj-proxy: 3.0.0
|
||||
jest: 28.1.3_k5ytkvaprncdyzidqqws5bqksq
|
||||
jest: 28.1.3_@types+node@16.11.12
|
||||
jest-matcher-specific-error: 1.0.0
|
||||
jest-transform-stub: 2.0.0
|
||||
ts-jest: 28.0.7_lhw3xkmzugq5tscs3x2ndm4sby
|
||||
|
@ -15205,7 +15207,7 @@ packages:
|
|||
'@jest/types': 28.1.3
|
||||
bs-logger: 0.2.6
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
jest: 28.1.3_k5ytkvaprncdyzidqqws5bqksq
|
||||
jest: 28.1.3_@types+node@16.11.12
|
||||
jest-util: 28.1.3
|
||||
json5: 2.2.1
|
||||
lodash.memoize: 4.1.2
|
||||
|
|
Loading…
Reference in a new issue