Skip to content

Commit 83fbb6e

Browse files
committed
chore: wip
1 parent 8b26c0b commit 83fbb6e

File tree

7 files changed

+144
-49
lines changed

7 files changed

+144
-49
lines changed

.stacks/core/config/src/defaults.ts

Lines changed: 130 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { StacksConfig } from '@stacksjs/types'
2+
import { path as p } from '@stacksjs/path'
23
import app from '~/config/app'
34
import binary from '~/config/binary'
45
import cache from '~/config/cache'
@@ -19,7 +20,7 @@ import security from '~/config/security'
1920
import services from '~/config/services'
2021
import ui from '~/config/ui'
2122

22-
const defaults: StacksConfig = {
23+
export const userConfig: StacksConfig = {
2324
app,
2425
binary,
2526
cache,
@@ -31,35 +32,140 @@ const defaults: StacksConfig = {
3132
git,
3233
hashing,
3334
library,
34-
notification,
3535
queue,
3636
payment,
37+
notification,
38+
storage,
3739
searchEngine,
3840
security,
3941
services,
40-
storage,
4142
ui,
4243
}
4344

44-
export {
45-
defaults,
46-
app,
47-
binary,
48-
cache,
49-
cloud,
50-
database,
51-
dns,
52-
docs,
53-
email,
54-
git,
55-
hashing,
56-
library,
57-
notification,
58-
queue,
59-
payment,
60-
searchEngine,
61-
security,
62-
services,
63-
storage,
64-
ui,
45+
export const defaults: StacksConfig = {
46+
app: {
47+
name: 'Stacks',
48+
env: 'local',
49+
url: 'stacks.test',
50+
subdomains: {
51+
docs: 'docs',
52+
api: 'api',
53+
},
54+
debug: true,
55+
key: '',
56+
timezone: 'UTC',
57+
locale: 'en',
58+
fallbackLocale: 'en',
59+
cipher: 'AES-256-CBC',
60+
docMode: false,
61+
},
62+
63+
binary: {
64+
name: 'buddy',
65+
command: 'buddy',
66+
description: 'Stacks is a full-stack framework for TypeScript.',
67+
source: p.appPath('commands'),
68+
},
69+
70+
cache: {
71+
driver: 'redis',
72+
prefix: 'stx',
73+
ttl: 3600,
74+
75+
drivers: {
76+
redis: {
77+
connection: 'default',
78+
host: 'localhost',
79+
port: 6379,
80+
},
81+
},
82+
},
83+
84+
cloud: {
85+
driver: 'aws',
86+
87+
storage: {
88+
useFileSystem: true,
89+
},
90+
91+
firewall: {
92+
immunity: 0,
93+
challenge: {
94+
captcha: {
95+
duration: 60,
96+
headerName: 'X-Captcha',
97+
headerValue: 'true',
98+
},
99+
},
100+
rules: [
101+
{
102+
name: 'default',
103+
priority: 0,
104+
action: { block: {} },
105+
visibilityConfig: {
106+
sampledRequestsEnabled: true,
107+
cloudWatchMetricsEnabled: true,
108+
metricName: 'default',
109+
},
110+
statement: {
111+
rateBasedStatement: {
112+
limit: 1000,
113+
aggregateKeyType: 'IP',
114+
},
115+
},
116+
},
117+
],
118+
},
119+
120+
cdn: {
121+
enableLogging: true,
122+
allowedMethods: 'GET_HEAD',
123+
cachedMethods: 'GET_HEAD',
124+
minTtl: 0,
125+
defaultTtl: 86400,
126+
maxTtl: 31536000,
127+
compress: true,
128+
priceClass: 'PriceClass_All',
129+
originShieldRegion: 'us-east-1',
130+
cookieBehavior: 'none',
131+
allowList: {
132+
cookies: [],
133+
headers: [],
134+
queryStrings: [],
135+
},
136+
},
137+
},
138+
139+
database: {
140+
default: 'sqlite',
141+
142+
name: 'stacks',
143+
144+
connections: {
145+
sqlite: {
146+
database: p.projectStoragePath('framework/database/stacks.sqlite'),
147+
prefix: '',
148+
}
149+
},
150+
},
151+
152+
dns: {
153+
driver: 'aws',
154+
a: [],
155+
aaaa: [],
156+
cname: [],
157+
mx: [],
158+
txt: [],
159+
},
160+
161+
docs: {},
162+
163+
email: {
164+
165+
},
65166
}
167+
168+
// export {
169+
// userConfig,
170+
// defaults,
171+
// }

.stacks/core/types/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface AppOptions {
2626
*
2727
* @default "development"
2828
*/
29-
env: 'dev' | 'development' | 'staging' | 'prod' | 'production'
29+
env: 'local' | 'dev' | 'development' | 'staging' | 'prod' | 'production'
3030

3131
/**
3232
* **Application URL**

.stacks/core/types/src/binary.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export interface BinaryOptions {
55
name: string
66
command: string
77
description: string
8+
source: string
89
// path: string // TODO: add this for a configurable path where the commands are located
910
}
1011

.stacks/core/types/src/database.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import { type Model } from './model'
2-
3-
export type DatabaseClient = any
4-
51
export interface DatabaseOptions {
62
default: string
73

@@ -12,11 +8,10 @@ export interface DatabaseOptions {
128
name: string
139

1410
connections: {
15-
mysql: {
11+
mysql?: {
1612
url?: string
1713
host?: string
1814
port?: number
19-
client?: DatabaseClient
2015
name?: string
2116
username?: string
2217
password?: string
@@ -29,8 +24,8 @@ export interface DatabaseOptions {
2924
prefix?: string
3025
}
3126

32-
planetscale: object
33-
postgres: object
27+
planetscale?: object
28+
postgres?: object
3429
}
3530

3631
migrations: string
@@ -48,10 +43,3 @@ export interface FactoryOptions {
4843
export interface SchemaOptions {
4944
database: string
5045
}
51-
52-
export interface DatabaseDriver {
53-
client: DatabaseClient
54-
migrate: (models: Model[], path: string, options?: SchemaOptions) => Promise<void>
55-
// seed: (modelName: string, data: SeedData) => Promise<void>
56-
factory: (modelName: string, fileName: string, path: string) => Promise<void>
57-
}

.stacks/core/types/src/dns.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ export type DnsRecord = ARecord | CNameRecord | MXRecord | TxtRecord | AAAARecor
4141
* @see https://stacksjs.dev/docs/dns
4242
*/
4343
export interface DnsOptions {
44-
a?: ARecord[]
45-
aaaa?: AAAARecord[]
46-
cname?: CNameRecord[]
47-
mx?: MXRecord[]
48-
txt?: TxtRecord[]
44+
driver: 'aws'
45+
a: ARecord[]
46+
aaaa: AAAARecord[]
47+
cname: CNameRecord[]
48+
mx: MXRecord[]
49+
txt: TxtRecord[]
4950
}
5051

5152
export type DnsConfig = Partial<DnsOptions>

.stacks/core/types/src/email.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { type IEmailOptions } from '@novu/stateless'
1+
import type { IEmailOptions } from '@novu/stateless'
22

33
export type EmailOptions = Omit<IEmailOptions, 'from'> & {
44
from: {
55
name?: string
66
address?: string
77
}
88

9-
mailboxes?: {
9+
mailboxes: {
1010
[key: string]: string
1111
// 'username': string
1212
// 'forwardTo': string

.stacks/core/types/src/stacks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,4 @@ export interface StacksOptions {
200200
ui: UiConfig
201201
}
202202

203-
export type StacksConfig = Required<StacksOptions>
204-
// export type StacksConfig = Required<StacksOptions>
203+
export type StacksConfig = Partial<StacksOptions>

0 commit comments

Comments
 (0)