Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default custom-env-config settings caused name conflicts #3193

Open
wants to merge 6 commits into
base: dove
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/generators/src/app/templates/app.test.tpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Server } from 'http'
import { app } from '../${lib}/app'

const port = app.get('port')
const appUrl = \`http://\${app.get('host')}:\${port}\`
const appUrl = \`http://localhost:\${port}\`

describe('Feathers application tests', () => {
let server: Server
Expand Down
2 changes: 1 addition & 1 deletion packages/generators/src/app/templates/client.test.tpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createClient } from '../${lib}/client'
import rest from '@feathersjs/rest-client'

const port = app.get('port')
const appUrl = \`http://\${app.get('host')}:\${port}\`
const appUrl = \`http://localhost:\${port}\`

describe('client tests', () => {
const client = createClient(rest(appUrl).axios(axios))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ const defaultConfig = ({}: AppGeneratorContext) => ({

const customEnvironment = {
port: {
__name: 'PORT',
__name: 'FEATHERS_PORT',
__format: 'number'
},
host: 'HOSTNAME',
host: 'FEATHERS_HOSTNAME',
origins: {
__name: 'FEATHERS_ORIGINS',
__format: 'json'
},
authentication: {
secret: 'FEATHERS_SECRET'
}
Expand All @@ -41,9 +45,9 @@ export const configurationSchema = {
required: [ 'host', 'port', 'public' ],
properties: {
...defaultAppSettings,
host: { type: 'string' },
port: { type: 'number' },
public: { type: 'string' }
public: { type: 'string' },
origins: { type: 'array', items: { type: 'string' } }
}
} as const

Expand All @@ -61,9 +65,9 @@ import { dataValidator } from './validators'
export const configurationSchema = Type.Intersect([
defaultAppConfiguration,
Type.Object({
host: Type.String(),
port: Type.Number(),
public: Type.String()
public: Type.String(),
origins: Type.Array(Type.String())
})
])

Expand Down
4 changes: 2 additions & 2 deletions packages/generators/src/app/templates/index.tpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ const template = ({}: AppGeneratorContext) => /* ts */ `import { app } from './a
import { logger } from './logger'

const port = app.get('port')
const host = app.get('host')
const origin = app.get('origins')[0]

process.on('unhandledRejection', (reason) =>
logger.error('Unhandled Rejection %O', reason)
)

app.listen(port).then(() => {
logger.info(\`Feathers app listening on http://\${host}:\${port}\`)
logger.info(\`Feathers app listening on \${origin}\`)
})
`

Expand Down